前準備(データ読み込み、ライブラリのインポート)

library("psych")
## Warning: package 'psych' was built under R version 3.5.3
library("skimr")
## Warning: package 'skimr' was built under R version 3.5.3
## 
## Attaching package: 'skimr'
## The following object is masked from 'package:stats':
## 
##     filter
library("plotly")
## Warning: package 'plotly' was built under R version 3.5.3
## Loading required package: ggplot2
## Warning: package 'ggplot2' was built under R version 3.5.3
## 
## Attaching package: 'ggplot2'
## The following objects are masked from 'package:psych':
## 
##     %+%, alpha
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
bank_marketing_train <- read.csv("../bank_marketing_train.csv")

1.ターゲットのペルソナを検討する

# y=yes/noのデータを抽出
bank_marketing_train_y <- bank_marketing_train[bank_marketing_train$y=="yes",]
bank_marketing_train_n <- bank_marketing_train[bank_marketing_train$y=="no",]


# データ数
num_yes = dim(bank_marketing_train_y)[1]
num_no = dim(bank_marketing_train_n)[1]

# ヒストグラム(特徴が表れていそうなもの)

# 年齢(age)
pl_yes <- plot_ly(x = bank_marketing_train_y$age, type="histogram", name = "yes")
pl_no <- plot_ly(x = bank_marketing_train_n$age, type="histogram", name = "no")
subplot(pl_yes, pl_no)
# => yesの方が、60以上が多い

# 職業(job)
pl_yes <- plot_ly(x = bank_marketing_train_y$job, type="histogram", name = "yes")
pl_no <- plot_ly(x = bank_marketing_train_n$job, type="histogram", name = "no")
subplot(pl_yes, pl_no)
# 割合をみてみる
summary(bank_marketing_train_y$job)/num_yes
##        admin.   blue-collar  entrepreneur     housemaid    management 
##   0.290832455   0.138040042   0.027924131   0.023182297   0.069810327 
##       retired self-employed      services       student    technician 
##   0.094309800   0.029504742   0.069810327   0.060590095   0.158324552 
##    unemployed       unknown 
##   0.030031612   0.007639621
summary(bank_marketing_train_n$job)/num_no
##        admin.   blue-collar  entrepreneur     housemaid    management 
##   0.248163483   0.235975691   0.036630159   0.026512622   0.069921197 
##       retired self-employed      services       student    technician 
##   0.035862161   0.033992253   0.099839722   0.016862562   0.164551890 
##    unemployed       unknown 
##   0.023640978   0.008047282
# => yesの方が、retired/studentが多く、blue-colorが少ない。特にstudentは約4倍、retiredは約3倍違いがでている

# 最終学歴(education)
pl_yes <- plot_ly(x = bank_marketing_train_y$education, type="histogram", name = "yes")
pl_no <- plot_ly(x = bank_marketing_train_n$education, type="histogram", name = "no")
subplot(pl_yes, pl_no)
# 割合をみてみる
summary(bank_marketing_train_y$education)/num_yes
##            basic.4y            basic.6y            basic.9y 
##         0.091938883         0.038461538         0.104320337 
##         high.school          illiterate professional.course 
##         0.223129610         0.001053741         0.127239199 
##   university.degree             unknown 
##         0.356691254         0.057165437
summary(bank_marketing_train_n$education)/num_no
##            basic.4y            basic.6y            basic.9y 
##        0.1028115400        0.0558634967        0.1534660077 
##         high.school          illiterate professional.course 
##        0.2331708294        0.0003673033        0.1262855616 
##   university.degree             unknown 
##        0.2877320689        0.0403031922
# => yesはilliterateが多い

# 連絡デバイス(contact)
pl_yes <- plot_ly(x = bank_marketing_train_y$contact, type="histogram", name = "yes")
pl_no <- plot_ly(x = bank_marketing_train_n$contact, type="histogram", name = "no")
subplot(pl_yes, pl_no)
# => yesはcellularが多い

# 以前のキャンペーン結果(campaign)
pl_yes <- plot_ly(x = bank_marketing_train_y$poutcome, type="histogram", name = "yes")
pl_no <- plot_ly(x = bank_marketing_train_n$poutcome, type="histogram", name = "no")
subplot(pl_yes, pl_no)
# 割合をみてみる
summary(bank_marketing_train_y$poutcome)/num_yes
##     failure nonexistent     success 
##   0.1290832   0.6817703   0.1891465
summary(bank_marketing_train_n$poutcome)/num_no# => yesはsuccessが多い(全体の割合としては2割だが、noは0.1割くらいなのでyesとnoの差はある)
##     failure nonexistent     success 
##  0.09867103  0.88793909  0.01338988
# 以前のキャンペーンの接触回数(previous)
pl_yes <- plot_ly(x = bank_marketing_train_y$previous, type="histogram", name = "yes")
pl_no <- plot_ly(x = bank_marketing_train_n$previous, type="histogram", name = "no")
subplot(pl_yes, pl_no)
summary(bank_marketing_train_y$previous)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.0000  0.0000  0.0000  0.4871  1.0000  6.0000
summary(bank_marketing_train_n$previous)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.0000  0.0000  0.0000  0.1315  0.0000  7.0000
# => yesは平均値が大きい(yes:0.48, no:0.13)しかし、この説明変数がどれだけ有効なのかは想像つかない

定性的な仮説

-年齢:入社後の22歳ごろと退職後の60歳ごろはyesが増えそう→60歳は合っている -職業:student、unemployedはyesが少なそう→外れている。studentは逆。 -婚姻状況:divorced(離婚)はyesが少なそう→外れ。傾向なし -クレジットの支払遅延:無しはyesが多そう→外れ。傾向なし -最終学歴:調べられなかった -不動産ローンの有無:無しはyesが多そう→外れ。傾向なし -個人ローンの有無:無しはyesが多そう→外れ。傾向なし -連絡デバイス:関係なさそう→外れ。yesはcellularが多い -前回の接触からの経過日数:短い方がyesが多そう(担当者を覚えている)→外れ。傾向なし -以前のキャンペーン結果:successがyesが多そう(継続してくれるのでは)→当たり -以前のキャンペーンの接触回数:数が多い方がyesが多そう(担当者を覚えている)→当たり

ロジスティック回帰で各説明変数を見る

## ロジスティック回帰
## 個人に紐づく、架電前に得られる説明変数のみ利用
lr<-glm(y~age+job+marital+default+education+housing+
          loan+contact+day_of_week+pdays+poutcome+previous,
        data=bank_marketing_train, family="binomial")


## step関数でAICを減らす
lr2 <- step(lr)
## Start:  AIC=20763.61
## y ~ age + job + marital + default + education + housing + loan + 
##     contact + day_of_week + pdays + poutcome + previous
## 
##               Df Deviance   AIC
## - housing      1    20690 20762
## <none>              20690 20764
## - loan         1    20693 20765
## - education    7    20712 20772
## - day_of_week  4    20707 20773
## - age          1    20702 20774
## - poutcome     2    20704 20774
## - previous     1    20706 20778
## - marital      3    20712 20780
## - pdays        1    20732 20804
## - default      2    20841 20911
## - job         11    20871 20923
## - contact      1    21013 21085
## 
## Step:  AIC=20762.21
## y ~ age + job + marital + default + education + loan + contact + 
##     day_of_week + pdays + poutcome + previous
## 
##               Df Deviance   AIC
## <none>              20690 20762
## - loan         2    20694 20762
## - education    7    20713 20771
## - day_of_week  4    20708 20772
## - age          1    20703 20773
## - poutcome     2    20705 20773
## - previous     1    20706 20776
## - marital      3    20712 20778
## - pdays        1    20733 20803
## - default      2    20841 20909
## - job         11    20872 20922
## - contact      1    21013 21083
AIC(lr2)
## [1] 20762.21
summary(lr2)
## 
## Call:
## glm(formula = y ~ age + job + marital + default + education + 
##     loan + contact + day_of_week + pdays + poutcome + previous, 
##     family = "binomial", data = bank_marketing_train)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -2.0639  -0.5021  -0.3837  -0.3010   2.8803  
## 
## Coefficients:
##                               Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                  -1.063603   0.292051  -3.642 0.000271 ***
## age                           0.007940   0.002243   3.541 0.000399 ***
## jobblue-collar               -0.274764   0.072316  -3.800 0.000145 ***
## jobentrepreneur              -0.199841   0.112115  -1.782 0.074673 .  
## jobhousemaid                 -0.120341   0.131644  -0.914 0.360642    
## jobmanagement                -0.094809   0.078278  -1.211 0.225825    
## jobretired                    0.612476   0.095242   6.431 1.27e-10 ***
## jobself-employed             -0.156807   0.110639  -1.417 0.156401    
## jobservices                  -0.209717   0.079214  -2.647 0.008109 ** 
## jobstudent                    0.788676   0.104768   7.528 5.16e-14 ***
## jobtechnician                -0.143732   0.064162  -2.240 0.025082 *  
## jobunemployed                 0.148129   0.117128   1.265 0.205986    
## jobunknown                   -0.178919   0.227348  -0.787 0.431292    
## maritalmarried                0.113629   0.062912   1.806 0.070893 .  
## maritalsingle                 0.298159   0.071041   4.197 2.70e-05 ***
## maritalunknown                0.126908   0.392171   0.324 0.746239    
## defaultunknown               -0.701074   0.060878 -11.516  < 2e-16 ***
## defaultyes                   -8.610256  84.476695  -0.102 0.918817    
## educationbasic.6y            -0.018758   0.111917  -0.168 0.866895    
## educationbasic.9y            -0.133104   0.086594  -1.537 0.124265    
## educationhigh.school         -0.062314   0.084078  -0.741 0.458606    
## educationilliterate           1.003878   0.635961   1.579 0.114446    
## educationprofessional.course -0.003529   0.092894  -0.038 0.969695    
## educationuniversity.degree    0.067691   0.083845   0.807 0.419475    
## educationunknown              0.268525   0.108378   2.478 0.013224 *  
## loanunknown                   0.041182   0.121540   0.339 0.734733    
## loanyes                      -0.101550   0.052615  -1.930 0.053602 .  
## contacttelephone             -0.805788   0.047171 -17.082  < 2e-16 ***
## day_of_weekmon               -0.141551   0.060938  -2.323 0.020186 *  
## day_of_weekthu                0.059907   0.058731   1.020 0.307711    
## day_of_weektue                0.054050   0.059707   0.905 0.365336    
## day_of_weekwed                0.066579   0.059795   1.113 0.265510    
## pdays                        -0.001463   0.000220  -6.649 2.95e-11 ***
## poutcomenonexistent           0.167511   0.092493   1.811 0.070130 .  
## poutcomesuccess               0.800045   0.214754   3.725 0.000195 ***
## previous                      0.245300   0.062066   3.952 7.74e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 23735  on 33743  degrees of freedom
## Residual deviance: 20690  on 33708  degrees of freedom
## AIC: 20762
## 
## Number of Fisher Scoring iterations: 9
# => 1回目の分析で特徴が出ていたもののうち、age, job, contact, previousは影響ありそう

ペルソナの推定

  • Age:60以上
  • Job:retired

Job:retiredのペルソナを基本に、データを絞ってペルソナを限定していく

# => Job:retiredの条件で、データを絞ってみてみる
bank_marketing_train_job_retired <- bank_marketing_train[bank_marketing_train$job == "retired",]
summary(bank_marketing_train_job_retired)
##       age                  job           marital    
##  Min.   :23.00   retired     :1432   divorced: 289  
##  1st Qu.:56.00   admin.      :   0   married :1061  
##  Median :59.00   blue-collar :   0   single  :  78  
##  Mean   :62.15   entrepreneur:   0   unknown :   4  
##  3rd Qu.:69.00   housemaid   :   0                  
##  Max.   :98.00   management  :   0                  
##                  (Other)     :   0                  
##                education      default        housing         loan     
##  basic.4y           :487   no     :1115   no     :645   no     :1185  
##  university.degree  :242   unknown: 317   unknown: 38   unknown:  38  
##  high.school        :235   yes    :   0   yes    :749   yes    : 209  
##  professional.course:200                                              
##  basic.9y           :121                                              
##  unknown            : 79                                              
##  (Other)            : 68                                              
##       contact     day_of_week    duration         campaign     
##  cellular :1043   fri:276     Min.   :   1.0   Min.   : 1.000  
##  telephone: 389   mon:299     1st Qu.: 116.0   1st Qu.: 1.000  
##                   thu:254     Median : 189.0   Median : 2.000  
##                   tue:314     Mean   : 273.8   Mean   : 2.443  
##                   wed:289     3rd Qu.: 342.2   3rd Qu.: 3.000  
##                               Max.   :2093.0   Max.   :42.000  
##                                                                
##      pdays          previous             poutcome     emp.var.rate    
##  Min.   :  1.0   Min.   :0.0000   failure    : 185   Min.   :-3.4000  
##  1st Qu.:999.0   1st Qu.:0.0000   nonexistent:1111   1st Qu.:-1.8000  
##  Median :999.0   Median :0.0000   success    : 136   Median :-1.1000  
##  Mean   :896.3   Mean   :0.3191                      Mean   :-0.7054  
##  3rd Qu.:999.0   3rd Qu.:0.0000                      3rd Qu.: 1.4000  
##  Max.   :999.0   Max.   :4.0000                      Max.   : 1.4000  
##                                                                       
##  cons.price.idx  cons.conf.idx      euribor3m      nr.employed  
##  Min.   :92.20   Min.   :-50.80   Min.   :0.634   Min.   :4964  
##  1st Qu.:92.89   1st Qu.:-42.70   1st Qu.:0.869   1st Qu.:5018  
##  Median :93.44   Median :-37.50   Median :1.415   Median :5099  
##  Mean   :93.42   Mean   :-38.57   Mean   :2.761   Mean   :5122  
##  3rd Qu.:93.99   3rd Qu.:-34.80   3rd Qu.:4.959   3rd Qu.:5228  
##  Max.   :94.77   Max.   :-26.90   Max.   :4.970   Max.   :5228  
##                                                                 
##    y       
##  no :1074  
##  yes: 358  
##            
##            
##            
##            
## 
# y=yes/noのデータを抽出してみる
bank_marketing_train_job_retired_y <- bank_marketing_train_job_retired[bank_marketing_train_job_retired$y=="yes",]
bank_marketing_train_job_retired_n <- bank_marketing_train_job_retired[bank_marketing_train_job_retired$y=="no",]
summary(bank_marketing_train_job_retired_y)
##       age                  job          marital   
##  Min.   :33.00   retired     :358   divorced: 78  
##  1st Qu.:60.00   admin.      :  0   married :270  
##  Median :68.00   blue-collar :  0   single  : 10  
##  Mean   :68.37   entrepreneur:  0   unknown :  0  
##  3rd Qu.:76.00   housemaid   :  0                 
##  Max.   :98.00   management  :  0                 
##                  (Other)     :  0                 
##                education      default       housing         loan    
##  basic.4y           :148   no     :330   no     :149   no     :297  
##  university.degree  : 60   unknown: 28   unknown:  9   unknown:  9  
##  high.school        : 54   yes    :  0   yes    :200   yes    : 52  
##  professional.course: 45                                            
##  unknown            : 28                                            
##  basic.9y           : 14                                            
##  (Other)            :  9                                            
##       contact    day_of_week    duration         campaign    
##  cellular :319   fri:64      Min.   :  63.0   Min.   : 1.00  
##  telephone: 39   mon:61      1st Qu.: 188.2   1st Qu.: 1.00  
##                  thu:62      Median : 311.0   Median : 1.00  
##                  tue:88      Mean   : 409.2   Mean   : 1.95  
##                  wed:83      3rd Qu.: 530.8   3rd Qu.: 2.00  
##                              Max.   :2093.0   Max.   :17.00  
##                                                              
##      pdays           previous             poutcome    emp.var.rate   
##  Min.   :  2.00   Min.   :0.0000   failure    : 51   Min.   :-3.400  
##  1st Qu.:  9.25   1st Qu.:0.0000   nonexistent:209   1st Qu.:-2.900  
##  Median :999.00   Median :0.0000   success    : 98   Median :-1.800  
##  Mean   :713.19   Mean   :0.6508                     Mean   :-1.939  
##  3rd Qu.:999.00   3rd Qu.:1.0000                     3rd Qu.:-1.700  
##  Max.   :999.00   Max.   :4.0000                     Max.   : 1.400  
##                                                                      
##  cons.price.idx  cons.conf.idx      euribor3m       nr.employed  
##  Min.   :92.20   Min.   :-50.80   Min.   :0.6340   Min.   :4964  
##  1st Qu.:92.65   1st Qu.:-42.70   1st Qu.:0.7205   1st Qu.:5009  
##  Median :93.08   Median :-37.50   Median :0.8760   Median :5018  
##  Mean   :93.24   Mean   :-37.58   Mean   :1.3329   Mean   :5052  
##  3rd Qu.:93.99   3rd Qu.:-31.40   3rd Qu.:1.3650   3rd Qu.:5099  
##  Max.   :94.77   Max.   :-26.90   Max.   :4.9680   Max.   :5228  
##                                                                  
##    y      
##  no :  0  
##  yes:358  
##           
##           
##           
##           
## 
summary(bank_marketing_train_job_retired_n)
##       age                  job           marital   
##  Min.   :23.00   retired     :1074   divorced:211  
##  1st Qu.:55.00   admin.      :   0   married :791  
##  Median :58.00   blue-collar :   0   single  : 68  
##  Mean   :60.08   entrepreneur:   0   unknown :  4  
##  3rd Qu.:63.75   housemaid   :   0                 
##  Max.   :95.00   management  :   0                 
##                  (Other)     :   0                 
##                education      default       housing         loan    
##  basic.4y           :339   no     :785   no     :496   no     :888  
##  university.degree  :182   unknown:289   unknown: 29   unknown: 29  
##  high.school        :181   yes    :  0   yes    :549   yes    :157  
##  professional.course:155                                            
##  basic.9y           :107                                            
##  basic.6y           : 58                                            
##  (Other)            : 52                                            
##       contact    day_of_week    duration         campaign     
##  cellular :724   fri:212     Min.   :   1.0   Min.   : 1.000  
##  telephone:350   mon:238     1st Qu.:  99.0   1st Qu.: 1.000  
##                  thu:192     Median : 160.0   Median : 2.000  
##                  tue:226     Mean   : 228.6   Mean   : 2.607  
##                  wed:206     3rd Qu.: 282.8   3rd Qu.: 3.000  
##                              Max.   :2055.0   Max.   :42.000  
##                                                               
##      pdays          previous             poutcome    emp.var.rate    
##  Min.   :  1.0   Min.   :0.0000   failure    :134   Min.   :-3.4000  
##  1st Qu.:999.0   1st Qu.:0.0000   nonexistent:902   1st Qu.:-1.8000  
##  Median :999.0   Median :0.0000   success    : 38   Median : 1.1000  
##  Mean   :957.4   Mean   :0.2086                     Mean   :-0.2944  
##  3rd Qu.:999.0   3rd Qu.:0.0000                     3rd Qu.: 1.4000  
##  Max.   :999.0   Max.   :4.0000                     Max.   : 1.4000  
##                                                                      
##  cons.price.idx  cons.conf.idx     euribor3m      nr.employed     y       
##  Min.   :92.20   Min.   :-50.8   Min.   :0.635   Min.   :4964   no :1074  
##  1st Qu.:92.96   1st Qu.:-42.7   1st Qu.:0.993   1st Qu.:5076   yes:   0  
##  Median :93.44   Median :-38.3   Median :4.856   Median :5191             
##  Mean   :93.48   Mean   :-38.9   Mean   :3.237   Mean   :5146             
##  3rd Qu.:93.99   3rd Qu.:-36.1   3rd Qu.:4.961   3rd Qu.:5228             
##  Max.   :94.77   Max.   :-26.9   Max.   :4.970   Max.   :5228             
## 
# データ数
num_retired_yes = dim(bank_marketing_train_job_retired_y)[1]
num_retired_no = dim(bank_marketing_train_job_retired_n)[1]

ヒストグラム

# 年齢
plot_ly(x = bank_marketing_train_job_retired_y$age, type="histogram")
plot_ly(x = bank_marketing_train_job_retired_n$age, type="histogram")
plot_ly(x = bank_marketing_train_job_retired$age, type="histogram", color = bank_marketing_train_job_retired$y)
## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels

## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels
plot_ly(x = bank_marketing_train_job_retired$age, type="box", color = bank_marketing_train_job_retired$y)
## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels

## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels
# => yesの方が、60以上が多い

# 婚姻状況
plot_ly(x = bank_marketing_train_job_retired$marital, type="histogram", color = bank_marketing_train_job_retired$y)
## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels

## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels
plot_ly(x = bank_marketing_train_job_retired$marital, type="box", color = bank_marketing_train_job_retired$y)
## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels

## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels
# 割合をみてみる
summary(bank_marketing_train_job_retired_y$marital)/num_retired_yes
##   divorced    married     single    unknown 
## 0.21787709 0.75418994 0.02793296 0.00000000
summary(bank_marketing_train_job_retired_n$marital)/num_retired_no
##    divorced     married      single     unknown 
## 0.196461825 0.736499069 0.063314711 0.003724395
# => yesはsingleが少ない

# クレジットの支払遅延
plot_ly(x = bank_marketing_train_job_retired$default, type="histogram", color = bank_marketing_train_job_retired$y)
## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels

## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels
plot_ly(x = bank_marketing_train_job_retired$default, type="box", color = bank_marketing_train_job_retired$y)
## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels

## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels
# 割合をみてみる
summary(bank_marketing_train_job_retired_y$default)/num_retired_yes
##         no    unknown        yes 
## 0.92178771 0.07821229 0.00000000
summary(bank_marketing_train_job_retired_n$default)/num_retired_no
##        no   unknown       yes 
## 0.7309125 0.2690875 0.0000000
# => yesはunknownが少なく、9割が"no"

# 最終学歴
#plot_ly(x = bank_marketing_train_job_retired$education, type="histogram", color = bank_marketing_train_job_retired$y)
#plot_ly(x = bank_marketing_train_job_retired$education, type="box", color = bank_marketing_train_job_retired$y)
pl_yes <- plot_ly(x = bank_marketing_train_job_retired_y$education, type="histogram", name = "yes")
pl_no <- plot_ly(x = bank_marketing_train_job_retired_n$education, type="histogram", name = "no")
subplot(pl_yes, pl_no)
# 割合をみてみる
summary(bank_marketing_train_job_retired_y$education)/num_retired_yes
##            basic.4y            basic.6y            basic.9y 
##         0.413407821         0.019553073         0.039106145 
##         high.school          illiterate professional.course 
##         0.150837989         0.005586592         0.125698324 
##   university.degree             unknown 
##         0.167597765         0.078212291
summary(bank_marketing_train_job_retired_n$education)/num_retired_no
##            basic.4y            basic.6y            basic.9y 
##        0.3156424581        0.0540037244        0.0996275605 
##         high.school          illiterate professional.course 
##        0.1685288641        0.0009310987        0.1443202980 
##   university.degree             unknown 
##        0.1694599628        0.0474860335
# => yesはbasic.4y, illiterate(学歴が高くない)が多い 

# 不動産ローンの有無
pl_yes <- plot_ly(x = bank_marketing_train_job_retired_y$housing, type="histogram", name = "yes")
pl_no <- plot_ly(x = bank_marketing_train_job_retired_n$housing, type="histogram", name = "no")
subplot(pl_yes, pl_no)
# 割合をみてみる
summary(bank_marketing_train_job_retired_y$housing)/num_retired_yes
##         no    unknown        yes 
## 0.41620112 0.02513966 0.55865922
summary(bank_marketing_train_job_retired_n$housing)/num_retired_no
##         no    unknown        yes 
## 0.46182495 0.02700186 0.51117318
# => 大きな差はない(yesは少しローン有が多い)

# 個人ローンの有無
plot_ly(x = bank_marketing_train_job_retired$loan, type="histogram", color = bank_marketing_train_job_retired$y)
## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels

## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels
pl_yes <- plot_ly(x = bank_marketing_train_job_retired_y$loan, type="histogram", name = "yes")
pl_no <- plot_ly(x = bank_marketing_train_job_retired_n$loan, type="histogram", name = "no")
subplot(pl_yes, pl_no)
# 割合をみてみる
summary(bank_marketing_train_job_retired_y$loan)/num_retired_yes
##         no    unknown        yes 
## 0.82960894 0.02513966 0.14525140
summary(bank_marketing_train_job_retired_n$loan)/num_retired_no
##         no    unknown        yes 
## 0.82681564 0.02700186 0.14618250
# => 差はなさそう

# 連絡デバイス
plot_ly(x = bank_marketing_train_job_retired$contact, type="histogram", color = bank_marketing_train_job_retired$y)
## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels

## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels
pl_yes <- plot_ly(x = bank_marketing_train_job_retired_y$contact, type="histogram", name = "yes")
pl_no <- plot_ly(x = bank_marketing_train_job_retired_n$contact, type="histogram", name = "no")
subplot(pl_yes, pl_no)
# 割合をみてみる
summary(bank_marketing_train_job_retired_y$contact)/num_retired_yes
##  cellular telephone 
## 0.8910615 0.1089385
summary(bank_marketing_train_job_retired_n$contact)/num_retired_no
##  cellular telephone 
## 0.6741155 0.3258845
# => yesはcellularが多い

# 前回の接触からの経過日数
#plot_ly(x = bank_marketing_train_job_retired$pdays, type="histogram", color = bank_marketing_train_job_retired$y)
pl_yes <- plot_ly(x = bank_marketing_train_job_retired_y$pdays, type="histogram", name = "yes")
pl_no <- plot_ly(x = bank_marketing_train_job_retired_n$pdays, type="histogram", name = "no")
subplot(pl_yes, pl_no)
# 割合をみてみる
summary(bank_marketing_train_job_retired_y$pdays)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    2.00    9.25  999.00  713.19  999.00  999.00
summary(bank_marketing_train_job_retired_n$pdays)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##     1.0   999.0   999.0   957.4   999.0   999.0
bank_marketing_train_job_retired_y
##       age     job  marital           education default housing    loan
## 3718   58 retired  married            basic.4y unknown      no      no
## 3875   59 retired  married professional.course unknown      no      no
## 4282   55 retired  married         high.school      no      no      no
## 4447   60 retired  married         high.school unknown     yes      no
## 5561   54 retired  married            basic.4y unknown      no      no
## 5660   59 retired  married professional.course      no      no      no
## 6689   59 retired divorced   university.degree      no      no      no
## 7007   52 retired  married            basic.4y      no      no      no
## 9052   59 retired  married            basic.9y      no     yes      no
## 9329   55 retired  married   university.degree unknown     yes      no
## 9685   56 retired  married         high.school unknown     yes      no
## 10162  59 retired  married professional.course unknown     yes     yes
## 10220  56 retired  married            basic.4y      no     yes      no
## 11005  58 retired  married            basic.4y      no      no      no
## 11383  53 retired  married            basic.9y unknown     yes      no
## 11695  57 retired  married   university.degree      no     yes     yes
## 11861  54 retired  married            basic.4y      no     yes     yes
## 12056  59 retired  married   university.degree unknown      no      no
## 12120  49 retired  married         high.school      no     yes      no
## 12656  57 retired divorced            basic.4y unknown      no      no
## 14096  55 retired  married professional.course      no     yes      no
## 14130  59 retired  married         high.school      no     yes      no
## 14522  60 retired divorced            basic.4y      no     yes      no
## 14609  60 retired divorced professional.course      no      no      no
## 15982  56 retired  married         high.school unknown     yes      no
## 16489  59 retired  married            basic.4y unknown      no      no
## 17004  60 retired  married            basic.9y unknown      no      no
## 17759  56 retired  married            basic.4y      no      no      no
## 18092  59 retired  married         high.school      no     yes      no
## 18696  60 retired  married             unknown      no     yes      no
## 18905  57 retired  married            basic.9y      no      no      no
## 19002  57 retired  married            basic.9y      no     yes     yes
## 19063  58 retired  married            basic.4y      no      no      no
## 19747  58 retired divorced            basic.9y      no     yes      no
## 20190  57 retired  married   university.degree      no     yes     yes
## 21510  58 retired  married         high.school      no      no      no
## 21776  50 retired divorced         high.school      no     yes      no
## 22708  70 retired divorced            basic.4y      no     yes      no
## 22783  88 retired divorced            basic.4y      no     yes     yes
## 22787  88 retired divorced            basic.4y      no     yes      no
## 22789  88 retired divorced            basic.4y      no     yes      no
## 22792  88 retired divorced            basic.4y      no     yes      no
## 22793  88 retired divorced            basic.4y      no     yes      no
## 22798  66 retired  married            basic.4y      no     yes      no
## 22831  68 retired  married   university.degree      no      no      no
## 22882  73 retired  married   university.degree      no     yes      no
## 22931  63 retired  married professional.course      no     yes      no
## 23041  55 retired  married            basic.4y      no     yes      no
## 23078  60 retired divorced            basic.4y      no      no      no
## 23173  63 retired  married             unknown      no      no      no
## 23174  63 retired  married             unknown      no     yes      no
## 23189  82 retired  married             unknown      no      no      no
## 23208  58 retired  married   university.degree      no unknown unknown
## 23304  73 retired divorced            basic.4y      no      no     yes
## 23323  59 retired  married   university.degree      no      no      no
## 23350  61 retired  married   university.degree      no     yes      no
## 23355  69 retired divorced   university.degree      no     yes      no
## 23362  70 retired  married            basic.4y      no     yes      no
## 23370  70 retired  married            basic.4y      no      no      no
## 23376  58 retired divorced   university.degree      no     yes      no
## 23404  66 retired  married            basic.4y      no     yes      no
## 23409  67 retired  married professional.course      no     yes      no
## 23420  58 retired divorced   university.degree      no     yes      no
## 23443  63 retired  married             unknown      no     yes      no
## 23530  70 retired  married             unknown      no     yes      no
## 23919  71 retired   single             unknown      no     yes      no
## 24043  60 retired  married            basic.4y unknown     yes      no
## 24204  68 retired  married         high.school      no     yes      no
## 24293  71 retired  married   university.degree      no      no      no
## 24306  75 retired divorced            basic.4y      no      no      no
## 24424  69 retired divorced            basic.4y      no     yes      no
## 24538  64 retired  married   university.degree      no     yes      no
## 24544  78 retired  married            basic.4y      no     yes      no
## 24545  57 retired  married            basic.4y      no     yes     yes
## 24546  75 retired  married            basic.4y      no      no      no
## 24550  61 retired  married professional.course      no unknown unknown
## 24558  65 retired  married            basic.4y      no unknown unknown
## 24564  75 retired  married            basic.4y      no      no      no
## 24568  78 retired  married            basic.4y      no     yes      no
## 24570  85 retired  married            basic.4y unknown     yes      no
## 24571  64 retired  married   university.degree      no      no      no
## 24589  64 retired  married            basic.4y      no     yes      no
## 24599  61 retired  married            basic.4y      no     yes      no
## 24600  65 retired  married   university.degree      no      no      no
## 24606  58 retired   single professional.course      no     yes      no
## 24675  79 retired  married            basic.9y      no     yes      no
## 24677  60 retired divorced professional.course      no     yes      no
## 24740  59 retired  married            basic.4y      no     yes      no
## 24809  69 retired  married   university.degree      no     yes      no
## 24824  58 retired divorced professional.course      no      no      no
## 24867  58 retired  married            basic.4y      no      no      no
## 24903  61 retired divorced   university.degree      no      no      no
## 24980  59 retired  married            basic.6y      no     yes      no
## 25111  33 retired  married         high.school      no     yes      no
## 29350  81 retired divorced             unknown unknown     yes     yes
## 29489  60 retired  married   university.degree      no     yes      no
## 29630  56 retired  married   university.degree      no      no      no
## 29705  59 retired  married professional.course      no     yes     yes
## 29710  65 retired  married            basic.9y      no      no      no
## 29764  58 retired divorced         high.school      no     yes      no
## 29882  59 retired  married professional.course      no     yes      no
## 30093  53 retired   single            basic.4y      no     yes      no
## 30122  55 retired  married         high.school      no     yes     yes
## 30155  74 retired  married            basic.4y      no     yes      no
## 30286  57 retired divorced            basic.9y      no     yes      no
## 30307  56 retired  married         high.school      no     yes     yes
## 30405  61 retired  married professional.course      no      no      no
## 30437  59 retired  married             unknown      no      no      no
## 30443  52 retired divorced   university.degree      no     yes     yes
## 30452  52 retired divorced   university.degree      no      no      no
## 30461  74 retired  married         high.school      no     yes      no
## 30473  76 retired  married            basic.4y      no     yes      no
## 30474  76 retired  married            basic.4y      no     yes      no
## 30485  75 retired  married            basic.4y      no      no     yes
## 30493  70 retired  married            basic.4y      no     yes      no
## 30498  73 retired  married            basic.4y      no      no      no
## 30522  76 retired  married   university.degree      no      no      no
## 30588  85 retired  married professional.course      no      no      no
## 30601  80 retired  married          illiterate unknown     yes     yes
## 30637  74 retired  married   university.degree      no     yes      no
## 30640  66 retired  married             unknown      no      no      no
## 30724  74 retired  married professional.course      no     yes      no
## 30755  62 retired  married             unknown      no      no      no
## 30776  55 retired  married            basic.4y      no     yes      no
## 30778  71 retired  married            basic.4y      no     yes      no
## 30780  70 retired  married professional.course      no     yes      no
## 30804  73 retired  married            basic.4y      no      no      no
## 30805  67 retired  married professional.course      no     yes     yes
## 30806  80 retired  married         high.school      no      no      no
## 30827  74 retired  married            basic.9y      no     yes      no
## 30829  67 retired  married            basic.6y      no      no      no
## 30833  61 retired  married   university.degree      no      no      no
## 30850  71 retired  married            basic.4y unknown unknown unknown
## 30854  64 retired  married         high.school unknown      no      no
## 30859  74 retired divorced            basic.4y      no     yes      no
## 30872  74 retired  married   university.degree      no     yes     yes
## 30875  64 retired  married            basic.4y      no     yes      no
## 30886  66 retired  married            basic.6y      no     yes      no
## 30896  71 retired   single   university.degree      no     yes      no
## 30912  61 retired  married            basic.4y      no     yes     yes
## 30913  61 retired  married            basic.4y      no     yes      no
## 30916  87 retired divorced            basic.4y      no      no      no
## 30932  64 retired  married             unknown      no      no      no
## 30963  58 retired  married         high.school      no      no      no
## 30966  54 retired  married professional.course unknown      no      no
## 30968  62 retired  married professional.course      no     yes      no
## 30970  58 retired  married         high.school      no     yes      no
## 30978  42 retired divorced          illiterate      no      no      no
## 30993  58 retired divorced         high.school      no      no      no
## 31010  62 retired  married professional.course      no     yes     yes
## 31023  73 retired  married            basic.4y      no unknown unknown
## 31053  79 retired  married            basic.9y      no      no      no
## 31107  61 retired  married   university.degree      no      no      no
## 31131  71 retired  married            basic.4y      no     yes      no
## 31137  75 retired  married             unknown      no      no      no
## 31146  58 retired  married            basic.4y      no      no      no
## 31160  76 retired  married            basic.4y      no     yes      no
## 31184  71 retired  married             unknown      no     yes      no
## 31193  70 retired  married            basic.4y      no      no      no
## 31237  70 retired divorced   university.degree      no     yes      no
## 31246  81 retired  married            basic.4y      no     yes      no
## 31254  61 retired  married         high.school      no     yes      no
## 31275  83 retired  married professional.course      no     yes      no
## 31279  82 retired  married   university.degree      no     yes      no
## 31282  69 retired divorced professional.course      no      no      no
## 31286  65 retired  married         high.school      no     yes      no
## 31306  63 retired  married         high.school      no      no      no
## 31326  77 retired  married   university.degree      no      no     yes
## 31340  80 retired  married            basic.4y      no      no      no
## 31363  74 retired  married             unknown      no     yes     yes
## 31387  74 retired  married            basic.9y      no     yes      no
## 31419  62 retired  married   university.degree unknown      no      no
## 31423  70 retired  married            basic.4y      no     yes      no
## 31427  60 retired  married            basic.4y      no      no      no
## 31479  56 retired  married professional.course      no      no      no
## 31495  98 retired  married            basic.4y unknown     yes      no
## 31498  98 retired  married            basic.4y unknown     yes      no
## 31525  68 retired  married            basic.4y      no     yes      no
## 31544  71 retired  married            basic.4y      no      no      no
## 31551  63 retired  married         high.school      no     yes      no
## 31567  62 retired  married         high.school      no      no      no
## 31573  55 retired  married            basic.4y      no     yes      no
## 31574  80 retired divorced         high.school      no     yes      no
## 31581  72 retired  married            basic.6y      no     yes     yes
## 31582  82 retired   single            basic.4y      no     yes      no
## 31594  69 retired  married            basic.4y      no     yes      no
## 31598  54 retired  married            basic.4y      no      no      no
## 31615  69 retired  married            basic.4y      no     yes     yes
## 31652  71 retired  married professional.course      no     yes      no
## 31660  79 retired  married            basic.4y      no      no     yes
## 31671  71 retired  married professional.course      no     yes     yes
## 31684  73 retired  married   university.degree      no      no     yes
## 31686  69 retired  married            basic.6y      no     yes      no
## 31695  69 retired  married         high.school      no      no      no
## 31703  76 retired   single            basic.4y      no      no      no
## 31718  79 retired  married            basic.4y      no      no     yes
## 31721  79 retired  married            basic.4y      no     yes      no
## 31734  72 retired  married            basic.4y      no     yes      no
## 31738  72 retired divorced            basic.6y      no     yes      no
## 31756  65 retired   single   university.degree      no      no      no
## 31763  67 retired  married            basic.4y      no     yes      no
## 31774  66 retired  married            basic.4y      no     yes     yes
## 31790  80 retired divorced             unknown      no     yes     yes
## 31793  65 retired  married   university.degree      no      no      no
## 31800  77 retired  married             unknown      no     yes      no
## 31805  78 retired divorced            basic.4y      no     yes      no
## 31811  61 retired  married            basic.4y      no     yes      no
## 31814  64 retired  married         high.school      no      no      no
## 31815  67 retired  married            basic.4y      no      no      no
## 31840  72 retired  married         high.school      no      no      no
## 31842  77 retired divorced            basic.4y      no     yes      no
## 31847  68 retired  married         high.school      no      no      no
## 31853  82 retired divorced            basic.4y      no     yes      no
## 31859  66 retired   single            basic.4y      no     yes      no
## 31861  83 retired divorced            basic.4y      no      no      no
## 31872  56 retired  married   university.degree      no     yes      no
## 31888  61 retired  married            basic.4y      no     yes      no
## 31889  58 retired  married            basic.4y      no     yes      no
## 31890  56 retired  married   university.degree      no      no      no
## 31901  78 retired  married professional.course      no      no      no
## 31905  73 retired  married   university.degree      no      no      no
## 31923  83 retired  married         high.school      no      no      no
## 31926  60 retired  married         high.school      no      no      no
## 31931  60 retired  married   university.degree      no      no      no
## 31964  86 retired  married professional.course      no      no      no
## 31972  56 retired  married            basic.4y      no      no      no
## 31980  81 retired divorced            basic.4y      no     yes      no
## 31989  85 retired divorced            basic.4y unknown     yes      no
## 31996  64 retired  married         high.school      no     yes      no
## 31997  70 retired  married            basic.4y      no      no      no
## 32003  76 retired  married   university.degree      no     yes     yes
## 32005  76 retired  married   university.degree      no      no     yes
## 32025  62 retired  married   university.degree      no     yes      no
## 32048  73 retired divorced         high.school      no     yes      no
## 32056  73 retired divorced         high.school      no      no     yes
## 32062  78 retired divorced professional.course      no     yes      no
## 32069  66 retired  married professional.course      no      no      no
## 32102  72 retired  married professional.course      no      no      no
## 32119  73 retired  married             unknown      no     yes      no
## 32128  64 retired  married   university.degree      no      no      no
## 32138  64 retired  married   university.degree      no      no      no
## 32164  80 retired  married            basic.4y      no      no      no
## 32175  82 retired  married professional.course      no     yes      no
## 32193  66 retired  married         high.school      no unknown unknown
## 32211  75 retired  married            basic.9y      no      no      no
## 32231  80 retired  married            basic.4y      no     yes      no
## 32237  78 retired  married             unknown      no      no      no
## 32261  68 retired divorced            basic.4y      no     yes      no
## 32268  64 retired  married            basic.4y      no     yes      no
## 32289  58 retired  married            basic.4y      no      no      no
## 32295  71 retired  married professional.course      no      no      no
## 32323  74 retired  married   university.degree      no      no      no
## 32332  68 retired  married   university.degree      no     yes      no
## 32335  82 retired divorced            basic.4y      no     yes     yes
## 32340  82 retired divorced            basic.4y      no      no      no
## 32342  74 retired  married            basic.4y      no      no      no
## 32345  75 retired divorced         high.school      no      no      no
## 32350  66 retired divorced            basic.4y      no     yes      no
## 32352  80 retired divorced            basic.4y      no     yes      no
## 32353  80 retired divorced            basic.4y      no     yes      no
## 32354  80 retired divorced            basic.4y      no     yes     yes
## 32358  77 retired  married         high.school      no     yes      no
## 32360  80 retired divorced            basic.4y      no     yes     yes
## 32365  73 retired   single professional.course      no      no      no
## 32475  77 retired  married   university.degree      no     yes      no
## 32491  70 retired  married            basic.4y      no     yes      no
## 32498  68 retired  married            basic.4y      no     yes     yes
## 32499  76 retired  married            basic.4y      no     yes      no
## 32510  63 retired  married professional.course      no     yes     yes
## 32512  74 retired divorced   university.degree      no     yes      no
## 32533  80 retired  married            basic.4y      no      no      no
## 32538  76 retired divorced            basic.4y      no     yes      no
## 32546  69 retired  married         high.school      no      no      no
## 32547  92 retired divorced             unknown unknown      no      no
## 32551  70 retired divorced         high.school      no     yes      no
## 32553  60 retired  married         high.school      no      no      no
## 32646  89 retired divorced            basic.4y      no      no      no
## 32681  78 retired divorced             unknown      no      no      no
## 32683  78 retired divorced             unknown      no      no      no
## 32718  69 retired divorced professional.course      no      no      no
## 32724  83 retired divorced            basic.4y      no      no     yes
## 32749  76 retired  married professional.course unknown     yes      no
## 32750  64 retired  married professional.course      no      no      no
## 32767  56 retired  married            basic.4y      no     yes      no
## 32811  75 retired  married   university.degree      no     yes      no
## 32826  72 retired  married            basic.4y      no      no     yes
## 32847  59 retired divorced            basic.4y      no     yes     yes
## 32856  73 retired  married            basic.4y      no     yes      no
## 32858  83 retired  married   university.degree      no     yes      no
## 32860  83 retired  married   university.degree      no      no      no
## 32861  66 retired  married         high.school      no     yes      no
## 32886  78 retired  married             unknown      no     yes      no
## 32897  80 retired  married            basic.4y      no      no      no
## 32898  70 retired divorced            basic.4y      no      no      no
## 32923  72 retired  married            basic.4y      no     yes      no
## 32924  78 retired  married            basic.4y      no     yes      no
## 32927  66 retired  married            basic.4y      no     yes      no
## 32928  78 retired  married            basic.4y      no     yes      no
## 32939  62 retired  married         high.school      no      no      no
## 32947  72 retired  married            basic.6y      no     yes      no
## 32979  68 retired  married   university.degree      no     yes      no
## 32980  68 retired  married   university.degree      no      no      no
## 32983  84 retired divorced            basic.4y      no     yes     yes
## 32992  77 retired  married            basic.4y      no unknown unknown
## 32995  68 retired divorced         high.school      no     yes     yes
## 33002  51 retired divorced         high.school      no      no      no
## 33009  80 retired divorced            basic.4y      no      no     yes
## 33028  71 retired  married            basic.9y      no     yes     yes
## 33040  62 retired  married            basic.4y      no      no      no
## 33041  67 retired  married            basic.4y      no      no      no
## 33047  64 retired  married professional.course      no      no      no
## 33056  75 retired  married             unknown      no      no      no
## 33064  61 retired  married   university.degree      no      no      no
## 33104  59 retired  married professional.course      no     yes      no
## 33109  59 retired  married professional.course      no      no      no
## 33115  64 retired  married            basic.4y      no unknown unknown
## 33134  92 retired  married             unknown      no      no     yes
## 33138  65 retired  married professional.course      no     yes      no
## 33142  70 retired  married            basic.4y      no     yes      no
## 33151  92 retired  married             unknown      no      no     yes
## 33164  76 retired  married   university.degree      no     yes      no
## 33189  44 retired   single         high.school      no      no      no
## 33214  76 retired divorced            basic.4y      no      no      no
## 33215  60 retired  married         high.school      no     yes      no
## 33216  56 retired  married   university.degree      no      no      no
## 33223  69 retired  married         high.school      no     yes     yes
## 33241  81 retired divorced            basic.4y      no      no      no
## 33257  60 retired  married   university.degree      no      no      no
## 33295  85 retired  married            basic.4y      no      no      no
## 33296  89 retired divorced            basic.4y      no     yes      no
## 33298  66 retired  married             unknown      no     yes      no
## 33304  86 retired  married            basic.4y      no     yes      no
## 33333  83 retired divorced            basic.4y      no      no      no
## 33335  64 retired divorced            basic.4y      no     yes     yes
## 33346  71 retired  married         high.school      no      no      no
## 33356  84 retired divorced             unknown unknown      no      no
## 33368  60 retired  married         high.school      no      no      no
## 33372  60 retired  married         high.school      no      no      no
## 33383  82 retired divorced            basic.4y      no     yes      no
## 33390  77 retired  married            basic.4y      no     yes      no
## 33504  61 retired  married            basic.4y      no      no      no
## 33511  66 retired  married            basic.4y      no     yes      no
## 33519  65 retired  married            basic.4y      no     yes     yes
## 33533  71 retired  married professional.course      no      no      no
## 33539  66 retired  married            basic.4y unknown unknown unknown
## 33540  65 retired  married            basic.4y      no     yes     yes
## 33560  65 retired  married            basic.4y      no      no      no
## 33565  68 retired divorced         high.school      no     yes     yes
## 33571  68 retired divorced         high.school      no     yes      no
## 33583  81 retired  married            basic.4y      no     yes      no
## 33590  80 retired  married professional.course      no     yes      no
## 33608  65 retired  married         high.school      no     yes     yes
## 33627  65 retired  married            basic.4y      no      no      no
## 33633  65 retired  married            basic.4y      no     yes      no
## 33670  63 retired  married            basic.4y      no     yes      no
## 33733  62 retired  married   university.degree      no     yes      no
## 33737  62 retired  married   university.degree      no      no      no
## 33742  73 retired  married professional.course      no     yes      no
##         contact day_of_week duration campaign pdays previous    poutcome
## 3718  telephone         tue     1045        1   999        0 nonexistent
## 3875  telephone         wed      905        1   999        0 nonexistent
## 4282  telephone         fri      924        1   999        0 nonexistent
## 4447  telephone         fri      597        6   999        0 nonexistent
## 5561  telephone         wed     1730        1   999        0 nonexistent
## 5660  telephone         wed      560        9   999        0 nonexistent
## 6689  telephone         mon      605        6   999        0 nonexistent
## 7007  telephone         wed      633        1   999        0 nonexistent
## 9052  telephone         wed     2093        1   999        0 nonexistent
## 9329  telephone         thu     1012        1   999        0 nonexistent
## 9685  telephone         fri     1094        3   999        0 nonexistent
## 10162  cellular         mon      494        4   999        0 nonexistent
## 10220  cellular         mon      621        2   999        0 nonexistent
## 11005  cellular         wed     1014        1   999        0 nonexistent
## 11383  cellular         fri      817        2   999        0 nonexistent
## 11695  cellular         mon     1062        4   999        0 nonexistent
## 11861 telephone         tue      533        3   999        0 nonexistent
## 12056  cellular         wed      767        5   999        0 nonexistent
## 12120  cellular         wed      555        1   999        0 nonexistent
## 12656  cellular         fri      655        4   999        0 nonexistent
## 14096  cellular         fri     1031        8   999        0 nonexistent
## 14130  cellular         fri     1448       17   999        0 nonexistent
## 14522  cellular         tue      600        1   999        0 nonexistent
## 14609  cellular         tue      454        5   999        0 nonexistent
## 15982  cellular         thu      674        1   999        0 nonexistent
## 16489  cellular         mon      555        1   999        0 nonexistent
## 17004  cellular         wed      707        3   999        0 nonexistent
## 17759  cellular         tue      933        2   999        0 nonexistent
## 18092  cellular         wed      625        5   999        0 nonexistent
## 18696  cellular         mon      600        2   999        0 nonexistent
## 18905  cellular         tue      388        4   999        0 nonexistent
## 19002  cellular         tue     1223        4   999        0 nonexistent
## 19063  cellular         tue      556        6   999        0 nonexistent
## 19747 telephone         mon      248        1   999        0 nonexistent
## 20190  cellular         mon     1132        2   999        0 nonexistent
## 21510  cellular         thu      477        1   999        0 nonexistent
## 21776  cellular         thu      691        1   999        0 nonexistent
## 22708  cellular         mon      187        3   999        0 nonexistent
## 22783  cellular         wed      796        5   999        0 nonexistent
## 22787  cellular         wed      126        1   999        0 nonexistent
## 22789  cellular         wed      101        7   999        0 nonexistent
## 22792  cellular         wed      188        3   999        0 nonexistent
## 22793  cellular         wed      101        1   999        0 nonexistent
## 22798  cellular         thu      156        1   999        0 nonexistent
## 22831  cellular         wed      201        1   999        0 nonexistent
## 22882  cellular         fri      179        1   999        0 nonexistent
## 22931  cellular         wed      387        2   999        0 nonexistent
## 23041  cellular         mon      158        1   999        0 nonexistent
## 23078  cellular         tue      465        4   999        0 nonexistent
## 23173  cellular         wed      150        1   999        1     failure
## 23174 telephone         wed      236        1   999        0 nonexistent
## 23189  cellular         wed      321        1   999        0 nonexistent
## 23208  cellular         wed      624        1   999        0 nonexistent
## 23304  cellular         tue      342        1   999        0 nonexistent
## 23323  cellular         tue     1073        1   999        0 nonexistent
## 23350  cellular         tue      216        1   999        0 nonexistent
## 23355  cellular         tue      207        2   999        0 nonexistent
## 23362  cellular         wed      223        2   999        0 nonexistent
## 23370  cellular         wed      167        2   999        1     failure
## 23376  cellular         wed      282        2   999        0 nonexistent
## 23404  cellular         wed      512       11   999        0 nonexistent
## 23409  cellular         wed      140        1   999        0 nonexistent
## 23420  cellular         wed      129        1   999        0 nonexistent
## 23443  cellular         thu      144        4   999        0 nonexistent
## 23530  cellular         thu      346        2   999        0 nonexistent
## 23919  cellular         fri      188        3   999        0 nonexistent
## 24043  cellular         fri      314        2   999        0 nonexistent
## 24204  cellular         mon      194        1   999        0 nonexistent
## 24293  cellular         mon      349        1   999        0 nonexistent
## 24306  cellular         mon      227        4   999        0 nonexistent
## 24424  cellular         mon      453        1   999        0 nonexistent
## 24538  cellular         tue      146        4   999        0 nonexistent
## 24544  cellular         tue      274        1   999        0 nonexistent
## 24545 telephone         tue     1348        4   999        0 nonexistent
## 24546  cellular         tue      109        1   999        1     failure
## 24550  cellular         tue      164        1   999        0 nonexistent
## 24558  cellular         tue      106        1   999        0 nonexistent
## 24564  cellular         tue      356        2   999        1     failure
## 24568 telephone         tue      137        2   999        0 nonexistent
## 24570  cellular         tue      129        3   999        0 nonexistent
## 24571  cellular         tue      157        4   999        0 nonexistent
## 24589  cellular         wed      104        1   999        2     failure
## 24599  cellular         wed      245        4   999        1     failure
## 24600  cellular         wed      124        2   999        0 nonexistent
## 24606  cellular         wed     1288        3   999        0 nonexistent
## 24675  cellular         thu      510        1   999        0 nonexistent
## 24677  cellular         thu      968        1     5        2     failure
## 24740  cellular         thu      381        1   999        1     failure
## 24809  cellular         thu      616        1   999        0 nonexistent
## 24824  cellular         thu      430        1   999        0 nonexistent
## 24867  cellular         thu      266        1   999        1     failure
## 24903  cellular         thu      949        2   999        0 nonexistent
## 24980  cellular         mon      228        6   999        0 nonexistent
## 25111  cellular         tue      762        3   999        0 nonexistent
## 29350  cellular         fri      176        1   999        0 nonexistent
## 29489  cellular         tue      133        1     3        1     success
## 29630  cellular         wed      108        2   999        0 nonexistent
## 29705  cellular         mon     1460        1   999        0 nonexistent
## 29710  cellular         mon      579        1   999        0 nonexistent
## 29764  cellular         tue      663        1   999        0 nonexistent
## 29882 telephone         wed      437        1   999        0 nonexistent
## 30093  cellular         mon      107        3   999        0 nonexistent
## 30122  cellular         fri      186        2   999        0 nonexistent
## 30155  cellular         mon      257        1   999        0 nonexistent
## 30286  cellular         fri      247        2   999        0 nonexistent
## 30307  cellular         fri      308        2   999        0 nonexistent
## 30405  cellular         tue      219        1   999        0 nonexistent
## 30437  cellular         wed      385        2   999        1     failure
## 30443  cellular         thu      155        2     4        1     success
## 30452  cellular         thu      427        1    15        1     success
## 30461  cellular         thu     1452        1   999        1     failure
## 30473  cellular         thu      550        1   999        0 nonexistent
## 30474  cellular         fri      345        2   999        0 nonexistent
## 30485  cellular         fri      714        1   999        0 nonexistent
## 30493  cellular         fri      530        2   999        0 nonexistent
## 30498  cellular         fri      453        1   999        0 nonexistent
## 30522  cellular         fri      233        2   999        0 nonexistent
## 30588  cellular         tue      140        1   999        0 nonexistent
## 30601  cellular         tue      125        1     6        1     success
## 30637  cellular         wed      239        2   999        1     failure
## 30640  cellular         wed      147        2   999        1     failure
## 30724  cellular         thu      204        3   999        1     failure
## 30755  cellular         fri      172        4   999        0 nonexistent
## 30776  cellular         fri      137        1     3        1     success
## 30778  cellular         fri      125        1   999        0 nonexistent
## 30780  cellular         fri       94        4   999        0 nonexistent
## 30804  cellular         mon      348        1   999        0 nonexistent
## 30805  cellular         mon      186        1   999        0 nonexistent
## 30806 telephone         mon      199        1   999        0 nonexistent
## 30827  cellular         mon      156        1   999        1     failure
## 30829  cellular         tue      460        2   999        0 nonexistent
## 30833 telephone         tue      249        2     3        1     success
## 30850  cellular         tue      216        1   999        0 nonexistent
## 30854  cellular         tue      301        1   999        1     failure
## 30859  cellular         wed      536        1    13        1     success
## 30872  cellular         wed      232        3   999        0 nonexistent
## 30875  cellular         wed      145        1     3        2     success
## 30886  cellular         thu      267        1   999        0 nonexistent
## 30896  cellular         thu      217        1     6        2     failure
## 30912  cellular         fri      374        1   999        0 nonexistent
## 30913  cellular         fri      168        1    15        1     success
## 30916  cellular         fri      273        1   999        0 nonexistent
## 30932  cellular         fri      252        4   999        0 nonexistent
## 30963  cellular         tue      130        2   999        0 nonexistent
## 30966  cellular         tue       95        2   999        0 nonexistent
## 30968  cellular         tue      531        3     6        1     success
## 30970  cellular         tue      242        6     3        1     success
## 30978 telephone         wed      128        3   999        0 nonexistent
## 30993  cellular         thu      398        2   999        1     failure
## 31010  cellular         fri      517        2   999        1     failure
## 31023  cellular         mon      160        3   999        1     failure
## 31053  cellular         tue      181        1   999        1     failure
## 31107  cellular         mon      350        1     3        2     success
## 31131  cellular         tue      206        1   999        0 nonexistent
## 31137  cellular         tue      191        1   999        1     failure
## 31146  cellular         wed      394        1   999        0 nonexistent
## 31160  cellular         wed      259        2     3        1     success
## 31184  cellular         fri      658        4   999        0 nonexistent
## 31193  cellular         tue      150        1     3        2     success
## 31237  cellular         fri      692        1   999        0 nonexistent
## 31246  cellular         fri      210        1   999        0 nonexistent
## 31254  cellular         wed      117        1     3        1     success
## 31275  cellular         fri      849        2     4        1     success
## 31279  cellular         tue      215        1   999        0 nonexistent
## 31282  cellular         tue      144        1   999        0 nonexistent
## 31286  cellular         tue      384        2   999        0 nonexistent
## 31306  cellular         wed      335        1   999        0 nonexistent
## 31326  cellular         mon      348        1   999        0 nonexistent
## 31340  cellular         tue      242        1   999        2     failure
## 31363  cellular         wed      251        1   999        0 nonexistent
## 31387  cellular         thu      134        2     6        1     success
## 31419  cellular         fri      717        2   999        0 nonexistent
## 31423  cellular         mon      131        1   999        0 nonexistent
## 31427  cellular         mon       98        1   999        0 nonexistent
## 31479  cellular         thu      133        1     3        1     success
## 31495  cellular         fri      476        1     2        2     success
## 31498  cellular         fri      272        2   999        0 nonexistent
## 31525  cellular         tue      102        1     6        2     success
## 31544  cellular         tue      353        1   999        0 nonexistent
## 31551  cellular         wed       96        1   999        0 nonexistent
## 31567  cellular         wed      207        1     6        1     success
## 31573  cellular         thu      139        1   999        0 nonexistent
## 31574  cellular         thu      169        1   999        0 nonexistent
## 31581  cellular         thu      189        3   999        0 nonexistent
## 31582  cellular         thu      251        2   999        0 nonexistent
## 31594  cellular         thu      124        1   999        0 nonexistent
## 31598  cellular         thu      377        1   999        0 nonexistent
## 31615  cellular         fri      257        3   999        0 nonexistent
## 31652  cellular         tue      102        1   999        0 nonexistent
## 31660  cellular         tue      149        1   999        0 nonexistent
## 31671 telephone         tue      383        1   999        0 nonexistent
## 31684  cellular         thu      749        7   999        0 nonexistent
## 31686  cellular         thu      355        3   999        0 nonexistent
## 31695  cellular         mon      178        1   999        0 nonexistent
## 31703  cellular         mon      347        4     6        1     success
## 31718  cellular         tue      301        2     3        1     success
## 31721  cellular         tue      594        1     3        1     success
## 31734  cellular         wed      406        1   999        1     failure
## 31738  cellular         wed      199        1   999        0 nonexistent
## 31756  cellular         thu      253        1   999        2     failure
## 31763  cellular         thu       99        1   999        0 nonexistent
## 31774 telephone         thu     1127        1   999        0 nonexistent
## 31790  cellular         fri      186        2     3        1     success
## 31793  cellular         fri      226        1     3        3     success
## 31800  cellular         fri      193        1     3        1     success
## 31805  cellular         fri      182        2     3        1     success
## 31811  cellular         mon      301        1     9        3     failure
## 31814  cellular         mon      146        1     3        1     success
## 31815 telephone         mon      167        1   999        0 nonexistent
## 31840  cellular         mon      257        1   999        0 nonexistent
## 31842  cellular         mon      445        2   999        1     failure
## 31847  cellular         mon     1248        2   999        1     failure
## 31853  cellular         tue      134        2     3        1     success
## 31859  cellular         tue      525        3   999        0 nonexistent
## 31861  cellular         tue      242        1     3        3     success
## 31872  cellular         wed      968        2     3        3     success
## 31888  cellular         wed      234        1   999        0 nonexistent
## 31889  cellular         wed      487        1   999        2     failure
## 31890  cellular         wed      232        1     3        1     success
## 31901  cellular         fri      319        2   999        1     failure
## 31905  cellular         fri      160        1   999        0 nonexistent
## 31923  cellular         thu      155        1     4        3     success
## 31926  cellular         thu      472        1   999        0 nonexistent
## 31931  cellular         fri      439        3     6        2     success
## 31964 telephone         wed      343        2   999        0 nonexistent
## 31972  cellular         thu      429        1   999        0 nonexistent
## 31980  cellular         fri      166        3   999        0 nonexistent
## 31989  cellular         mon      321        3     6        1     success
## 31996  cellular         wed      354        1   999        0 nonexistent
## 31997  cellular         wed      546        2   999        0 nonexistent
## 32003  cellular         thu      330        2     4        2     success
## 32005  cellular         thu      324        3     4        2     success
## 32025  cellular         wed      282        1     6        1     success
## 32048  cellular         tue      284        1   999        0 nonexistent
## 32056  cellular         tue       63        3     6        2     success
## 32062  cellular         tue      591        1   999        1     failure
## 32069  cellular         tue      177        1   999        1     failure
## 32102  cellular         fri       87        1     3        1     success
## 32119 telephone         mon      659        1   999        0 nonexistent
## 32128  cellular         tue      139        2     6        1     success
## 32138  cellular         tue      700        2     5        1     success
## 32164  cellular         fri      213        3     6        4     success
## 32175 telephone         mon      506        2   999        0 nonexistent
## 32193  cellular         tue      881        3   999        1     failure
## 32211  cellular         mon      293        2   999        1     failure
## 32231  cellular         thu      156        1   999        0 nonexistent
## 32237  cellular         thu      272        1     6        2     success
## 32261  cellular         tue      277        2    11        1     success
## 32268  cellular         wed      262        2   999        0 nonexistent
## 32289  cellular         wed     1307        1   999        0 nonexistent
## 32295  cellular         thu      559        1   999        0 nonexistent
## 32323  cellular         thu      200        1   999        0 nonexistent
## 32332  cellular         fri      330        3   999        0 nonexistent
## 32335  cellular         mon      125        2   999        0 nonexistent
## 32340  cellular         mon      529        1     6        2     success
## 32342 telephone         mon     1143        5   999        0 nonexistent
## 32345 telephone         tue      162        1     6        2     success
## 32350  cellular         wed      476        1   999        0 nonexistent
## 32352 telephone         wed      403        1   999        0 nonexistent
## 32353 telephone         wed      623        2   999        0 nonexistent
## 32354  cellular         wed      654        2   999        0 nonexistent
## 32358  cellular         thu      165        7   999        0 nonexistent
## 32360  cellular         thu      554        1    10        2     success
## 32365  cellular         fri      291        1     6        3     success
## 32475  cellular         wed      152        1     6        4     success
## 32491  cellular         thu      331        1     3        2     success
## 32498  cellular         fri      220        1     6        1     success
## 32499  cellular         fri     1205        2     6        2     success
## 32510  cellular         mon      444        2    14        1     success
## 32512  cellular         tue      387        1   999        0 nonexistent
## 32533  cellular         mon      382        1     3        3     success
## 32538  cellular         mon      168        1   999        1     failure
## 32546  cellular         wed      289        1    10        1     success
## 32547  cellular         wed      405        3   999        1     failure
## 32551 telephone         wed      283        2     4        2     success
## 32553  cellular         thu      181        3     6        1     success
## 32646  cellular         mon      245        1   999        0 nonexistent
## 32681  cellular         thu      282        4   999        0 nonexistent
## 32683  cellular         thu      544        1   999        0 nonexistent
## 32718  cellular         fri      213        6    12        2     failure
## 32724  cellular         fri      472        2   999        0 nonexistent
## 32749  cellular         tue      352        1     3        1     success
## 32750  cellular         tue      222        1   999        3     failure
## 32767  cellular         wed      337        2     3        2     success
## 32811  cellular         thu      229        1   999        2     failure
## 32826  cellular         fri      483        4     8        1     success
## 32847  cellular         mon      796        1     6        1     success
## 32856  cellular         tue      305        1   999        0 nonexistent
## 32858  cellular         tue      178        1     6        2     success
## 32860 telephone         tue      617        1    12        1     success
## 32861  cellular         tue      317        1   999        0 nonexistent
## 32886  cellular         wed       87        3   999        0 nonexistent
## 32897 telephone         thu      552        2   999        0 nonexistent
## 32898  cellular         thu      390        2     6        2     success
## 32923  cellular         mon      268        1   999        0 nonexistent
## 32924  cellular         mon      173        2   999        1     failure
## 32927  cellular         mon      568        7   999        0 nonexistent
## 32928  cellular         mon      212        1    13        2     success
## 32939  cellular         tue      355        2   999        0 nonexistent
## 32947  cellular         wed      143        1   999        0 nonexistent
## 32979  cellular         mon      546        2   999        1     failure
## 32980  cellular         mon      414        2    12        1     success
## 32983  cellular         tue      666        1     3        2     success
## 32992  cellular         tue      218        2     3        1     success
## 32995  cellular         wed      340        1     3        1     success
## 33002  cellular         wed      115        3   999        0 nonexistent
## 33009  cellular         thu      169        2     6        2     success
## 33028  cellular         fri      230        6   999        0 nonexistent
## 33040  cellular         mon      317        1     9        2     failure
## 33041  cellular         mon      341        2    13        1     success
## 33047  cellular         tue      482        1   999        0 nonexistent
## 33056 telephone         tue      676        2   999        4     failure
## 33064 telephone         wed      250        2     7        1     success
## 33104  cellular         fri      303        2     3        2     success
## 33109  cellular         fri      218        3     3        1     success
## 33115 telephone         fri      245        3   999        0 nonexistent
## 33134  cellular         tue     1064        1     3        1     success
## 33138  cellular         tue      261        1     6        3     success
## 33142  cellular         tue      356        3     6        1     success
## 33151  cellular         wed      370        1     3        4     success
## 33164  cellular         thu      504        2     6        3     success
## 33189  cellular         mon     2035        4   999        0 nonexistent
## 33214  cellular         tue      185        1   999        1     failure
## 33215  cellular         tue      443        2   999        2     failure
## 33216  cellular         tue      634        3   999        1     failure
## 33223  cellular         wed      840        1     6        2     success
## 33241  cellular         wed      532        2     7        1     success
## 33257  cellular         thu      799        2   999        0 nonexistent
## 33295  cellular         tue      728        1     3        2     success
## 33296  cellular         tue      314        1   999        0 nonexistent
## 33298  cellular         tue     1394        2     6        1     success
## 33304  cellular         tue      288        3   999        0 nonexistent
## 33333  cellular         thu      268        1     9        3     success
## 33335 telephone         fri      211        2     6        2     success
## 33346  cellular         mon      363        1   999        0 nonexistent
## 33356  cellular         tue      333        1     3        2     success
## 33368  cellular         wed     1640        1   999        0 nonexistent
## 33372  cellular         wed      200        1     6        1     success
## 33383  cellular         thu      143        2   999        1     failure
## 33390  cellular         thu      190        1   999        0 nonexistent
## 33504 telephone         fri      194        1   999        0 nonexistent
## 33511 telephone         fri      369        2   999        1     failure
## 33519  cellular         mon      165        1     3        1     success
## 33533  cellular         tue      323        1   999        0 nonexistent
## 33539  cellular         wed      216        1     6        3     success
## 33540  cellular         wed      190        1     3        3     success
## 33560  cellular         fri      187        2     7        3     success
## 33565  cellular         mon      567        1     3        1     success
## 33571  cellular         mon      222        1   999        0 nonexistent
## 33583  cellular         wed      621        1   999        2     failure
## 33590  cellular         thu      411        1   999        1     failure
## 33608  cellular         fri      344        2    12        1     success
## 33627  cellular         wed      882        1   999        0 nonexistent
## 33633  cellular         wed      258        1     3        3     success
## 33670  cellular         fri      413        1     3        2     success
## 33733  cellular         thu      329        1   999        2     failure
## 33737  cellular         thu      483        2     6        3     success
## 33742  cellular         fri      334        1   999        0 nonexistent
##       emp.var.rate cons.price.idx cons.conf.idx euribor3m nr.employed   y
## 3718           1.1         93.994         -36.4     4.856      5191.0 yes
## 3875           1.1         93.994         -36.4     4.858      5191.0 yes
## 4282           1.1         93.994         -36.4     4.857      5191.0 yes
## 4447           1.1         93.994         -36.4     4.857      5191.0 yes
## 5561           1.1         93.994         -36.4     4.857      5191.0 yes
## 5660           1.1         93.994         -36.4     4.857      5191.0 yes
## 6689           1.4         94.465         -41.8     4.865      5228.1 yes
## 7007           1.4         94.465         -41.8     4.864      5228.1 yes
## 9052           1.4         94.465         -41.8     4.962      5228.1 yes
## 9329           1.4         94.465         -41.8     4.961      5228.1 yes
## 9685           1.4         94.465         -41.8     4.959      5228.1 yes
## 10162          1.4         93.918         -42.7     4.960      5228.1 yes
## 10220          1.4         93.918         -42.7     4.960      5228.1 yes
## 11005          1.4         93.918         -42.7     4.962      5228.1 yes
## 11383          1.4         93.918         -42.7     4.963      5228.1 yes
## 11695          1.4         93.918         -42.7     4.962      5228.1 yes
## 11861          1.4         93.918         -42.7     4.961      5228.1 yes
## 12056          1.4         93.918         -42.7     4.957      5228.1 yes
## 12120          1.4         93.918         -42.7     4.957      5228.1 yes
## 12656          1.4         93.918         -42.7     4.957      5228.1 yes
## 14096          1.4         93.918         -42.7     4.962      5228.1 yes
## 14130          1.4         93.918         -42.7     4.962      5228.1 yes
## 14522          1.4         93.918         -42.7     4.961      5228.1 yes
## 14609          1.4         93.918         -42.7     4.961      5228.1 yes
## 15982          1.4         93.444         -36.1     4.968      5228.1 yes
## 16489          1.4         93.444         -36.1     4.965      5228.1 yes
## 17004          1.4         93.444         -36.1     4.965      5228.1 yes
## 17759          1.4         93.444         -36.1     4.963      5228.1 yes
## 18092          1.4         93.444         -36.1     4.964      5228.1 yes
## 18696          1.4         93.444         -36.1     4.965      5228.1 yes
## 18905          1.4         93.444         -36.1     4.965      5228.1 yes
## 19002          1.4         93.444         -36.1     4.965      5228.1 yes
## 19063          1.4         93.444         -36.1     4.965      5228.1 yes
## 19747         -0.1         93.200         -42.0     4.406      5195.8 yes
## 20190         -0.1         93.200         -42.0     4.191      5195.8 yes
## 21510         -0.1         93.200         -42.0     4.076      5195.8 yes
## 21776         -0.1         93.200         -42.0     4.076      5195.8 yes
## 22708         -1.8         92.843         -50.0     1.811      5099.1 yes
## 22783         -1.8         92.843         -50.0     1.663      5099.1 yes
## 22787         -1.8         92.843         -50.0     1.663      5099.1 yes
## 22789         -1.8         92.843         -50.0     1.663      5099.1 yes
## 22792         -1.8         92.843         -50.0     1.663      5099.1 yes
## 22793         -1.8         92.843         -50.0     1.663      5099.1 yes
## 22798         -1.8         92.843         -50.0     1.650      5099.1 yes
## 22831         -1.8         92.843         -50.0     1.602      5099.1 yes
## 22882         -1.8         92.843         -50.0     1.531      5099.1 yes
## 22931         -1.8         93.075         -47.1     1.498      5099.1 yes
## 23041         -1.8         93.075         -47.1     1.466      5099.1 yes
## 23078         -1.8         93.075         -47.1     1.453      5099.1 yes
## 23173         -1.8         93.075         -47.1     1.445      5099.1 yes
## 23174         -1.8         93.075         -47.1     1.445      5099.1 yes
## 23189         -1.8         93.075         -47.1     1.445      5099.1 yes
## 23208         -1.8         93.075         -47.1     1.445      5099.1 yes
## 23304         -1.8         93.075         -47.1     1.423      5099.1 yes
## 23323         -1.8         93.075         -47.1     1.423      5099.1 yes
## 23350         -1.8         93.075         -47.1     1.423      5099.1 yes
## 23355         -1.8         93.075         -47.1     1.423      5099.1 yes
## 23362         -1.8         93.075         -47.1     1.415      5099.1 yes
## 23370         -1.8         93.075         -47.1     1.415      5099.1 yes
## 23376         -1.8         93.075         -47.1     1.415      5099.1 yes
## 23404         -1.8         93.075         -47.1     1.415      5099.1 yes
## 23409         -1.8         93.075         -47.1     1.415      5099.1 yes
## 23420         -1.8         93.075         -47.1     1.415      5099.1 yes
## 23443         -1.8         93.075         -47.1     1.410      5099.1 yes
## 23530         -1.8         93.075         -47.1     1.410      5099.1 yes
## 23919         -1.8         93.075         -47.1     1.405      5099.1 yes
## 24043         -1.8         93.075         -47.1     1.405      5099.1 yes
## 24204         -1.8         93.075         -47.1     1.405      5099.1 yes
## 24293         -1.8         93.075         -47.1     1.405      5099.1 yes
## 24306         -1.8         93.075         -47.1     1.405      5099.1 yes
## 24424         -1.8         93.075         -47.1     1.405      5099.1 yes
## 24538         -1.8         93.075         -47.1     1.405      5099.1 yes
## 24544         -1.8         93.075         -47.1     1.405      5099.1 yes
## 24545         -1.8         93.075         -47.1     1.405      5099.1 yes
## 24546         -1.8         93.075         -47.1     1.405      5099.1 yes
## 24550         -1.8         93.075         -47.1     1.405      5099.1 yes
## 24558         -1.8         93.075         -47.1     1.405      5099.1 yes
## 24564         -1.8         93.075         -47.1     1.405      5099.1 yes
## 24568         -1.8         93.075         -47.1     1.405      5099.1 yes
## 24570         -1.8         93.075         -47.1     1.405      5099.1 yes
## 24571         -1.8         93.075         -47.1     1.405      5099.1 yes
## 24589         -1.8         93.075         -47.1     1.405      5099.1 yes
## 24599         -1.8         93.075         -47.1     1.405      5099.1 yes
## 24600         -1.8         93.075         -47.1     1.405      5099.1 yes
## 24606         -1.8         93.075         -47.1     1.405      5099.1 yes
## 24675         -1.8         93.075         -47.1     1.365      5099.1 yes
## 24677         -1.8         93.075         -47.1     1.365      5099.1 yes
## 24740         -1.8         93.075         -47.1     1.365      5099.1 yes
## 24809         -1.8         93.075         -47.1     1.365      5099.1 yes
## 24824         -1.8         93.075         -47.1     1.365      5099.1 yes
## 24867         -1.8         93.075         -47.1     1.365      5099.1 yes
## 24903         -1.8         93.075         -47.1     1.365      5099.1 yes
## 24980         -1.8         92.893         -46.2     1.354      5099.1 yes
## 25111         -1.8         92.893         -46.2     1.344      5099.1 yes
## 29350         -1.8         92.893         -46.2     1.259      5099.1 yes
## 29489         -1.8         92.893         -46.2     1.266      5099.1 yes
## 29630         -1.8         92.893         -46.2     1.270      5099.1 yes
## 29705         -2.9         92.963         -40.8     1.266      5076.2 yes
## 29710         -2.9         92.963         -40.8     1.266      5076.2 yes
## 29764         -2.9         92.963         -40.8     1.262      5076.2 yes
## 29882         -2.9         92.963         -40.8     1.260      5076.2 yes
## 30093         -2.9         92.963         -40.8     1.281      5076.2 yes
## 30122         -2.9         92.963         -40.8     1.268      5076.2 yes
## 30155         -2.9         92.963         -40.8     1.260      5076.2 yes
## 30286         -2.9         92.469         -33.6     1.059      5076.2 yes
## 30307         -2.9         92.469         -33.6     1.059      5076.2 yes
## 30405         -2.9         92.201         -31.4     0.884      5076.2 yes
## 30437         -2.9         92.201         -31.4     0.884      5076.2 yes
## 30443         -2.9         92.201         -31.4     0.883      5076.2 yes
## 30452         -2.9         92.201         -31.4     0.883      5076.2 yes
## 30461         -2.9         92.201         -31.4     0.883      5076.2 yes
## 30473         -2.9         92.201         -31.4     0.883      5076.2 yes
## 30474         -2.9         92.201         -31.4     0.881      5076.2 yes
## 30485         -2.9         92.201         -31.4     0.881      5076.2 yes
## 30493         -2.9         92.201         -31.4     0.881      5076.2 yes
## 30498         -2.9         92.201         -31.4     0.881      5076.2 yes
## 30522         -2.9         92.201         -31.4     0.881      5076.2 yes
## 30588         -2.9         92.201         -31.4     0.883      5076.2 yes
## 30601         -2.9         92.201         -31.4     0.883      5076.2 yes
## 30637         -2.9         92.201         -31.4     0.879      5076.2 yes
## 30640         -2.9         92.201         -31.4     0.879      5076.2 yes
## 30724         -2.9         92.201         -31.4     0.873      5076.2 yes
## 30755         -2.9         92.201         -31.4     0.869      5076.2 yes
## 30776         -2.9         92.201         -31.4     0.869      5076.2 yes
## 30778         -2.9         92.201         -31.4     0.869      5076.2 yes
## 30780         -2.9         92.201         -31.4     0.869      5076.2 yes
## 30804         -2.9         92.201         -31.4     0.861      5076.2 yes
## 30805         -2.9         92.201         -31.4     0.861      5076.2 yes
## 30806         -2.9         92.201         -31.4     0.861      5076.2 yes
## 30827         -2.9         92.201         -31.4     0.861      5076.2 yes
## 30829         -2.9         92.201         -31.4     0.859      5076.2 yes
## 30833         -2.9         92.201         -31.4     0.859      5076.2 yes
## 30850         -2.9         92.201         -31.4     0.859      5076.2 yes
## 30854         -2.9         92.201         -31.4     0.859      5076.2 yes
## 30859         -2.9         92.201         -31.4     0.854      5076.2 yes
## 30872         -2.9         92.201         -31.4     0.854      5076.2 yes
## 30875         -2.9         92.201         -31.4     0.854      5076.2 yes
## 30886         -2.9         92.201         -31.4     0.851      5076.2 yes
## 30896         -2.9         92.201         -31.4     0.851      5076.2 yes
## 30912         -2.9         92.201         -31.4     0.849      5076.2 yes
## 30913         -2.9         92.201         -31.4     0.849      5076.2 yes
## 30916         -2.9         92.201         -31.4     0.849      5076.2 yes
## 30932         -2.9         92.201         -31.4     0.849      5076.2 yes
## 30963         -2.9         92.201         -31.4     0.838      5076.2 yes
## 30966         -2.9         92.201         -31.4     0.838      5076.2 yes
## 30968         -2.9         92.201         -31.4     0.838      5076.2 yes
## 30970         -2.9         92.201         -31.4     0.838      5076.2 yes
## 30978         -2.9         92.201         -31.4     0.834      5076.2 yes
## 30993         -2.9         92.201         -31.4     0.829      5076.2 yes
## 31010         -2.9         92.201         -31.4     0.825      5076.2 yes
## 31023         -2.9         92.201         -31.4     0.821      5076.2 yes
## 31053         -3.4         92.379         -29.8     0.819      5017.5 yes
## 31107         -3.4         92.379         -29.8     0.797      5017.5 yes
## 31131         -3.4         92.379         -29.8     0.788      5017.5 yes
## 31137         -3.4         92.379         -29.8     0.788      5017.5 yes
## 31146         -3.4         92.379         -29.8     0.781      5017.5 yes
## 31160         -3.4         92.379         -29.8     0.781      5017.5 yes
## 31184         -3.4         92.379         -29.8     0.773      5017.5 yes
## 31193         -3.4         92.379         -29.8     0.770      5017.5 yes
## 31237         -3.4         92.379         -29.8     0.741      5017.5 yes
## 31246         -3.4         92.379         -29.8     0.741      5017.5 yes
## 31254         -3.4         92.379         -29.8     0.753      5017.5 yes
## 31275         -3.4         92.431         -26.9     0.752      5017.5 yes
## 31279         -3.4         92.431         -26.9     0.744      5017.5 yes
## 31282         -3.4         92.431         -26.9     0.744      5017.5 yes
## 31286         -3.4         92.431         -26.9     0.744      5017.5 yes
## 31306         -3.4         92.431         -26.9     0.740      5017.5 yes
## 31326         -3.4         92.431         -26.9     0.743      5017.5 yes
## 31340         -3.4         92.431         -26.9     0.742      5017.5 yes
## 31363         -3.4         92.431         -26.9     0.742      5017.5 yes
## 31387         -3.4         92.431         -26.9     0.740      5017.5 yes
## 31419         -3.4         92.431         -26.9     0.739      5017.5 yes
## 31423         -3.4         92.431         -26.9     0.739      5017.5 yes
## 31427         -3.4         92.431         -26.9     0.739      5017.5 yes
## 31479         -3.4         92.431         -26.9     0.733      5017.5 yes
## 31495         -3.4         92.431         -26.9     0.730      5017.5 yes
## 31498         -3.4         92.431         -26.9     0.730      5017.5 yes
## 31525         -3.4         92.431         -26.9     0.728      5017.5 yes
## 31544         -3.4         92.431         -26.9     0.728      5017.5 yes
## 31551         -3.4         92.431         -26.9     0.724      5017.5 yes
## 31567         -3.4         92.431         -26.9     0.724      5017.5 yes
## 31573         -3.4         92.431         -26.9     0.722      5017.5 yes
## 31574         -3.4         92.431         -26.9     0.722      5017.5 yes
## 31581         -3.4         92.431         -26.9     0.722      5017.5 yes
## 31582         -3.4         92.431         -26.9     0.722      5017.5 yes
## 31594         -3.4         92.431         -26.9     0.722      5017.5 yes
## 31598         -3.4         92.431         -26.9     0.722      5017.5 yes
## 31615         -3.4         92.431         -26.9     0.720      5017.5 yes
## 31652         -3.4         92.649         -30.1     0.720      5017.5 yes
## 31660         -3.4         92.649         -30.1     0.720      5017.5 yes
## 31671         -3.4         92.649         -30.1     0.720      5017.5 yes
## 31684         -3.4         92.649         -30.1     0.716      5017.5 yes
## 31686         -3.4         92.649         -30.1     0.716      5017.5 yes
## 31695         -3.4         92.649         -30.1     0.715      5017.5 yes
## 31703         -3.4         92.649         -30.1     0.715      5017.5 yes
## 31718         -3.4         92.649         -30.1     0.715      5017.5 yes
## 31721         -3.4         92.649         -30.1     0.715      5017.5 yes
## 31734         -3.4         92.649         -30.1     0.715      5017.5 yes
## 31738         -3.4         92.649         -30.1     0.715      5017.5 yes
## 31756         -3.4         92.649         -30.1     0.714      5017.5 yes
## 31763         -3.4         92.649         -30.1     0.714      5017.5 yes
## 31774         -3.4         92.649         -30.1     0.714      5017.5 yes
## 31790         -3.4         92.649         -30.1     0.714      5017.5 yes
## 31793         -3.4         92.649         -30.1     0.714      5017.5 yes
## 31800         -3.4         92.649         -30.1     0.714      5017.5 yes
## 31805         -3.4         92.649         -30.1     0.714      5017.5 yes
## 31811         -3.4         92.649         -30.1     0.714      5017.5 yes
## 31814         -3.4         92.649         -30.1     0.714      5017.5 yes
## 31815         -3.4         92.649         -30.1     0.714      5017.5 yes
## 31840         -3.4         92.649         -30.1     0.714      5017.5 yes
## 31842         -3.4         92.649         -30.1     0.714      5017.5 yes
## 31847         -3.4         92.649         -30.1     0.714      5017.5 yes
## 31853         -3.4         92.649         -30.1     0.715      5017.5 yes
## 31859         -3.4         92.649         -30.1     0.715      5017.5 yes
## 31861         -3.4         92.649         -30.1     0.716      5017.5 yes
## 31872         -3.4         92.649         -30.1     0.716      5017.5 yes
## 31888         -3.4         92.649         -30.1     0.716      5017.5 yes
## 31889         -3.4         92.649         -30.1     0.716      5017.5 yes
## 31890         -3.4         92.649         -30.1     0.716      5017.5 yes
## 31901         -3.4         92.649         -30.1     0.718      5017.5 yes
## 31905         -3.4         92.649         -30.1     0.718      5017.5 yes
## 31923         -3.0         92.713         -33.0     0.720      5023.5 yes
## 31926         -3.0         92.713         -33.0     0.720      5023.5 yes
## 31931         -3.0         92.713         -33.0     0.718      5023.5 yes
## 31964         -3.0         92.713         -33.0     0.715      5023.5 yes
## 31972         -3.0         92.713         -33.0     0.714      5023.5 yes
## 31980         -3.0         92.713         -33.0     0.714      5023.5 yes
## 31989         -3.0         92.713         -33.0     0.715      5023.5 yes
## 31996         -3.0         92.713         -33.0     0.715      5023.5 yes
## 31997         -3.0         92.713         -33.0     0.715      5023.5 yes
## 32003         -3.0         92.713         -33.0     0.712      5023.5 yes
## 32005         -3.0         92.713         -33.0     0.712      5023.5 yes
## 32025         -3.0         92.713         -33.0     0.706      5023.5 yes
## 32048         -3.0         92.713         -33.0     0.707      5023.5 yes
## 32056         -3.0         92.713         -33.0     0.707      5023.5 yes
## 32062         -1.8         93.369         -34.8     0.655      5008.7 yes
## 32069         -1.8         93.369         -34.8     0.655      5008.7 yes
## 32102         -1.8         93.369         -34.8     0.653      5008.7 yes
## 32119         -1.8         93.369         -34.8     0.652      5008.7 yes
## 32128         -1.8         93.369         -34.8     0.652      5008.7 yes
## 32138         -1.8         93.369         -34.8     0.652      5008.7 yes
## 32164         -1.8         93.369         -34.8     0.649      5008.7 yes
## 32175         -1.8         93.369         -34.8     0.646      5008.7 yes
## 32193         -1.8         93.369         -34.8     0.646      5008.7 yes
## 32211         -1.8         93.369         -34.8     0.639      5008.7 yes
## 32231         -1.8         93.369         -34.8     0.635      5008.7 yes
## 32237         -1.8         93.369         -34.8     0.635      5008.7 yes
## 32261         -1.8         93.369         -34.8     0.635      5008.7 yes
## 32268         -1.8         93.369         -34.8     0.634      5008.7 yes
## 32289         -1.8         93.749         -34.6     0.639      5008.7 yes
## 32295         -1.8         93.749         -34.6     0.640      5008.7 yes
## 32323         -1.8         93.749         -34.6     0.644      5008.7 yes
## 32332         -1.8         93.749         -34.6     0.644      5008.7 yes
## 32335         -1.8         93.749         -34.6     0.643      5008.7 yes
## 32340         -1.8         93.749         -34.6     0.643      5008.7 yes
## 32342         -1.8         93.749         -34.6     0.643      5008.7 yes
## 32345         -1.8         93.749         -34.6     0.642      5008.7 yes
## 32350         -1.8         93.749         -34.6     0.642      5008.7 yes
## 32352         -1.8         93.749         -34.6     0.642      5008.7 yes
## 32353         -1.8         93.749         -34.6     0.642      5008.7 yes
## 32354         -1.8         93.749         -34.6     0.642      5008.7 yes
## 32358         -1.8         93.749         -34.6     0.644      5008.7 yes
## 32360         -1.8         93.749         -34.6     0.644      5008.7 yes
## 32365         -1.8         93.749         -34.6     0.645      5008.7 yes
## 32475         -1.8         93.876         -40.0     0.682      5008.7 yes
## 32491         -1.8         93.876         -40.0     0.683      5008.7 yes
## 32498         -1.8         93.876         -40.0     0.684      5008.7 yes
## 32499         -1.8         93.876         -40.0     0.684      5008.7 yes
## 32510         -1.8         93.876         -40.0     0.685      5008.7 yes
## 32512         -1.8         93.876         -40.0     0.688      5008.7 yes
## 32533         -1.8         93.876         -40.0     0.697      5008.7 yes
## 32538         -1.8         93.876         -40.0     0.697      5008.7 yes
## 32546         -1.8         93.876         -40.0     0.697      5008.7 yes
## 32547         -1.8         93.876         -40.0     0.697      5008.7 yes
## 32551         -1.8         93.876         -40.0     0.697      5008.7 yes
## 32553         -1.8         93.876         -40.0     0.699      5008.7 yes
## 32646         -1.7         94.055         -39.8     0.720      4991.6 yes
## 32681         -1.7         94.055         -39.8     0.729      4991.6 yes
## 32683         -1.7         94.055         -39.8     0.729      4991.6 yes
## 32718         -1.7         94.055         -39.8     0.748      4991.6 yes
## 32724         -1.7         94.055         -39.8     0.748      4991.6 yes
## 32749         -1.7         94.055         -39.8     0.761      4991.6 yes
## 32750         -1.7         94.055         -39.8     0.761      4991.6 yes
## 32767         -1.7         94.055         -39.8     0.767      4991.6 yes
## 32811         -1.7         94.215         -40.3     0.810      4991.6 yes
## 32826         -1.7         94.215         -40.3     0.822      4991.6 yes
## 32847         -1.7         94.215         -40.3     0.827      4991.6 yes
## 32856         -1.7         94.215         -40.3     0.835      4991.6 yes
## 32858         -1.7         94.215         -40.3     0.835      4991.6 yes
## 32860         -1.7         94.215         -40.3     0.835      4991.6 yes
## 32861         -1.7         94.215         -40.3     0.835      4991.6 yes
## 32886         -1.7         94.215         -40.3     0.840      4991.6 yes
## 32897         -1.7         94.215         -40.3     0.846      4991.6 yes
## 32898         -1.7         94.215         -40.3     0.846      4991.6 yes
## 32923         -1.7         94.215         -40.3     0.870      4991.6 yes
## 32924         -1.7         94.215         -40.3     0.870      4991.6 yes
## 32927         -1.7         94.215         -40.3     0.870      4991.6 yes
## 32928         -1.7         94.215         -40.3     0.870      4991.6 yes
## 32939         -1.7         94.215         -40.3     0.876      4991.6 yes
## 32947         -1.7         94.215         -40.3     0.881      4991.6 yes
## 32979         -1.7         94.215         -40.3     0.889      4991.6 yes
## 32980         -1.7         94.215         -40.3     0.889      4991.6 yes
## 32983         -1.7         94.215         -40.3     0.893      4991.6 yes
## 32992         -1.7         94.215         -40.3     0.893      4991.6 yes
## 32995         -1.7         94.215         -40.3     0.896      4991.6 yes
## 33002         -1.7         94.215         -40.3     0.896      4991.6 yes
## 33009         -1.7         94.215         -40.3     0.899      4991.6 yes
## 33028         -1.7         94.215         -40.3     0.896      4991.6 yes
## 33040         -1.7         94.027         -38.3     0.898      4991.6 yes
## 33041         -1.7         94.027         -38.3     0.898      4991.6 yes
## 33047         -1.7         94.027         -38.3     0.899      4991.6 yes
## 33056         -1.7         94.027         -38.3     0.899      4991.6 yes
## 33064         -1.7         94.027         -38.3     0.900      4991.6 yes
## 33104         -1.7         94.027         -38.3     0.905      4991.6 yes
## 33109         -1.7         94.027         -38.3     0.905      4991.6 yes
## 33115         -1.7         94.027         -38.3     0.905      4991.6 yes
## 33134         -1.7         94.027         -38.3     0.904      4991.6 yes
## 33138         -1.7         94.027         -38.3     0.904      4991.6 yes
## 33142         -1.7         94.027         -38.3     0.904      4991.6 yes
## 33151         -1.7         94.027         -38.3     0.903      4991.6 yes
## 33164         -1.7         94.027         -38.3     0.899      4991.6 yes
## 33189         -1.7         94.027         -38.3     0.896      4991.6 yes
## 33214         -1.7         94.027         -38.3     0.886      4991.6 yes
## 33215         -1.7         94.027         -38.3     0.886      4991.6 yes
## 33216         -1.7         94.027         -38.3     0.886      4991.6 yes
## 33223         -1.1         94.199         -37.5     0.886      4963.6 yes
## 33241         -1.1         94.199         -37.5     0.886      4963.6 yes
## 33257         -1.1         94.199         -37.5     0.884      4963.6 yes
## 33295         -1.1         94.199         -37.5     0.881      4963.6 yes
## 33296         -1.1         94.199         -37.5     0.881      4963.6 yes
## 33298         -1.1         94.199         -37.5     0.881      4963.6 yes
## 33304         -1.1         94.199         -37.5     0.881      4963.6 yes
## 33333         -1.1         94.199         -37.5     0.879      4963.6 yes
## 33335         -1.1         94.199         -37.5     0.878      4963.6 yes
## 33346         -1.1         94.199         -37.5     0.879      4963.6 yes
## 33356         -1.1         94.199         -37.5     0.877      4963.6 yes
## 33368         -1.1         94.199         -37.5     0.876      4963.6 yes
## 33372         -1.1         94.199         -37.5     0.876      4963.6 yes
## 33383         -1.1         94.199         -37.5     0.879      4963.6 yes
## 33390         -1.1         94.199         -37.5     0.879      4963.6 yes
## 33504         -1.1         94.601         -49.5     0.972      4963.6 yes
## 33511         -1.1         94.601         -49.5     0.972      4963.6 yes
## 33519         -1.1         94.601         -49.5     0.977      4963.6 yes
## 33533         -1.1         94.601         -49.5     0.982      4963.6 yes
## 33539         -1.1         94.601         -49.5     0.985      4963.6 yes
## 33540         -1.1         94.601         -49.5     0.985      4963.6 yes
## 33560         -1.1         94.601         -49.5     0.993      4963.6 yes
## 33565         -1.1         94.601         -49.5     1.000      4963.6 yes
## 33571         -1.1         94.601         -49.5     1.000      4963.6 yes
## 33583         -1.1         94.601         -49.5     1.016      4963.6 yes
## 33590         -1.1         94.601         -49.5     1.025      4963.6 yes
## 33608         -1.1         94.601         -49.5     1.029      4963.6 yes
## 33627         -1.1         94.601         -49.5     1.043      4963.6 yes
## 33633         -1.1         94.601         -49.5     1.043      4963.6 yes
## 33670         -1.1         94.767         -50.8     1.049      4963.6 yes
## 33733         -1.1         94.767         -50.8     1.031      4963.6 yes
## 33737         -1.1         94.767         -50.8     1.031      4963.6 yes
## 33742         -1.1         94.767         -50.8     1.028      4963.6 yes
# => yesは日数が短い人の割合が大きい

# 以前のキャンペーン結果
#plot_ly(x = bank_marketing_train_job_retired$poutcome, type="histogram", color = bank_marketing_train_job_retired$y)
pl_yes <- plot_ly(x = bank_marketing_train_job_retired_y$poutcome, type="histogram", name = "yes")
pl_no <- plot_ly(x = bank_marketing_train_job_retired_n$poutcome, type="histogram", name = "no")
subplot(pl_yes, pl_no)
# 割合をみてみる
summary(bank_marketing_train_job_retired_y$poutcome)/num_retired_yes
##     failure nonexistent     success 
##   0.1424581   0.5837989   0.2737430
summary(bank_marketing_train_job_retired_n$poutcome)/num_retired_no
##     failure nonexistent     success 
##  0.12476723  0.83985102  0.03538175
# => yesはfailure, successが多い

# 以前のキャンペーンの接触回数
pl_yes <- plot_ly(x = bank_marketing_train_job_retired_y$previous, type="histogram", name = "yes")
pl_no <- plot_ly(x = bank_marketing_train_job_retired_n$previous, type="histogram", name = "no")
subplot(pl_yes, pl_no)
# 割合をみてみる
summary(bank_marketing_train_job_retired_y$previous)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.0000  0.0000  0.0000  0.6508  1.0000  4.0000
summary(bank_marketing_train_job_retired_n$previous)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.0000  0.0000  0.0000  0.2086  0.0000  4.0000
# => yesは平均値が大きい(yes:0.65, no:0.20)しかし、この説明変数がどれだけ有効なのかは想像つかない

最終的なペルソナ

2.予測モデルを用いたアタックリストを作成する

人に依存しない説明変数も含め、すべての変数に対して統計値を確認しておく

ただしday_of_week, duration, campaignは架電後の説明変数と考え、除去する

lr3<-glm(y~.-day_of_week-duration-campaign,
        data=bank_marketing_train, family="binomial")

summary(lr3)
## 
## Call:
## glm(formula = y ~ . - day_of_week - duration - campaign, family = "binomial", 
##     data = bank_marketing_train)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.9013  -0.4129  -0.3240  -0.2778   2.9504  
## 
## Coefficients: (1 not defined because of singularities)
##                                Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                  -9.508e+01  1.600e+01  -5.944 2.79e-09 ***
## age                           1.383e-03  2.318e-03   0.597  0.55060    
## jobblue-collar               -1.963e-01  7.484e-02  -2.623  0.00871 ** 
## jobentrepreneur              -8.459e-02  1.153e-01  -0.734  0.46322    
## jobhousemaid                 -1.070e-01  1.389e-01  -0.770  0.44109    
## jobmanagement                -7.113e-02  8.211e-02  -0.866  0.38631    
## jobretired                    2.807e-01  1.028e-01   2.731  0.00632 ** 
## jobself-employed             -1.509e-01  1.146e-01  -1.317  0.18772    
## jobservices                  -1.568e-01  8.150e-02  -1.925  0.05428 .  
## jobstudent                    2.415e-01  1.088e-01   2.219  0.02649 *  
## jobtechnician                -2.015e-02  6.753e-02  -0.298  0.76540    
## jobunemployed                -5.372e-02  1.223e-01  -0.439  0.66040    
## jobunknown                   -2.881e-01  2.362e-01  -1.219  0.22267    
## maritalmarried                5.616e-02  6.552e-02   0.857  0.39137    
## maritalsingle                 1.196e-01  7.447e-02   1.605  0.10840    
## maritalunknown                6.134e-02  4.103e-01   0.150  0.88115    
## educationbasic.6y             4.597e-02  1.151e-01   0.399  0.68959    
## educationbasic.9y            -5.598e-02  8.954e-02  -0.625  0.53181    
## educationhigh.school         -1.073e-02  8.735e-02  -0.123  0.90226    
## educationilliterate           1.192e+00  6.560e-01   1.817  0.06914 .  
## educationprofessional.course  4.639e-02  9.657e-02   0.480  0.63096    
## educationuniversity.degree    1.052e-01  8.729e-02   1.206  0.22791    
## educationunknown              2.121e-01  1.133e-01   1.872  0.06122 .  
## defaultunknown               -3.176e-01  6.312e-02  -5.032 4.86e-07 ***
## defaultyes                   -7.644e+00  8.447e+01  -0.090  0.92790    
## housingunknown               -3.040e-02  1.279e-01  -0.238  0.81208    
## housingyes                   -4.811e-02  3.933e-02  -1.223  0.22125    
## loanunknown                          NA         NA      NA       NA    
## loanyes                      -8.754e-02  5.471e-02  -1.600  0.10960    
## contacttelephone             -8.601e-01  6.075e-02 -14.156  < 2e-16 ***
## pdays                        -1.176e-03  2.207e-04  -5.326 1.00e-07 ***
## previous                     -5.077e-02  6.156e-02  -0.825  0.40954    
## poutcomenonexistent           5.005e-01  9.467e-02   5.287 1.24e-07 ***
## poutcomesuccess               6.782e-01  2.158e-01   3.143  0.00167 ** 
## emp.var.rate                 -7.105e-01  6.552e-02 -10.844  < 2e-16 ***
## cons.price.idx                1.099e+00  1.043e-01  10.534  < 2e-16 ***
## cons.conf.idx                 3.879e-02  6.027e-03   6.436 1.23e-10 ***
## euribor3m                     6.074e-02  8.249e-02   0.736  0.46148    
## nr.employed                  -1.506e-03  1.451e-03  -1.038  0.29949    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 23735  on 33743  degrees of freedom
## Residual deviance: 19114  on 33706  degrees of freedom
## AIC: 19190
## 
## Number of Fisher Scoring iterations: 9
## step関数
lr4 <- step(lr3)
## Start:  AIC=19189.68
## y ~ (age + job + marital + education + default + housing + loan + 
##     contact + day_of_week + duration + campaign + pdays + previous + 
##     poutcome + emp.var.rate + cons.price.idx + cons.conf.idx + 
##     euribor3m + nr.employed) - day_of_week - duration - campaign
## 
##                  Df Deviance   AIC
## - marital         3    19117 19187
## - age             1    19114 19188
## - euribor3m       1    19114 19188
## - previous        1    19114 19188
## - nr.employed     1    19115 19189
## - education       7    19127 19189
## - housing         1    19115 19189
## <none>                 19114 19190
## - loan            1    19116 19190
## - job            11    19150 19204
## - default         2    19141 19213
## - pdays           1    19142 19216
## - poutcome        2    19147 19219
## - cons.conf.idx   1    19155 19229
## - cons.price.idx  1    19221 19295
## - emp.var.rate    1    19230 19304
## - contact         1    19327 19401
## 
## Step:  AIC=19186.58
## y ~ age + job + education + default + housing + loan + contact + 
##     pdays + previous + poutcome + emp.var.rate + cons.price.idx + 
##     cons.conf.idx + euribor3m + nr.employed
## 
##                  Df Deviance   AIC
## - age             1    19117 19185
## - euribor3m       1    19117 19185
## - previous        1    19117 19185
## - nr.employed     1    19118 19186
## - housing         1    19118 19186
## - education       7    19130 19186
## <none>                 19117 19187
## - loan            1    19119 19187
## - job            11    19158 19206
## - default         2    19143 19209
## - pdays           1    19145 19213
## - poutcome        2    19150 19216
## - cons.conf.idx   1    19159 19227
## - cons.price.idx  1    19225 19293
## - emp.var.rate    1    19234 19302
## - contact         1    19331 19399
## 
## Step:  AIC=19184.58
## y ~ job + education + default + housing + loan + contact + pdays + 
##     previous + poutcome + emp.var.rate + cons.price.idx + cons.conf.idx + 
##     euribor3m + nr.employed
## 
##                  Df Deviance   AIC
## - euribor3m       1    19117 19183
## - previous        1    19117 19183
## - nr.employed     1    19118 19184
## - housing         1    19118 19184
## - education       7    19130 19184
## <none>                 19117 19185
## - loan            1    19119 19185
## - job            11    19160 19206
## - default         2    19144 19208
## - pdays           1    19145 19211
## - poutcome        2    19150 19214
## - cons.conf.idx   1    19159 19225
## - cons.price.idx  1    19225 19291
## - emp.var.rate    1    19234 19300
## - contact         1    19331 19397
## 
## Step:  AIC=19183.09
## y ~ job + education + default + housing + loan + contact + pdays + 
##     previous + poutcome + emp.var.rate + cons.price.idx + cons.conf.idx + 
##     nr.employed
## 
##                  Df Deviance   AIC
## - nr.employed     1    19118 19182
## - previous        1    19118 19182
## - housing         1    19119 19183
## - education       7    19131 19183
## <none>                 19117 19183
## - loan            1    19120 19184
## - job            11    19160 19204
## - default         2    19145 19207
## - pdays           1    19145 19209
## - poutcome        2    19151 19213
## - cons.conf.idx   1    19227 19291
## - emp.var.rate    1    19248 19312
## - cons.price.idx  1    19256 19320
## - contact         1    19332 19396
## 
## Step:  AIC=19181.66
## y ~ job + education + default + housing + loan + contact + pdays + 
##     previous + poutcome + emp.var.rate + cons.price.idx + cons.conf.idx
## 
##                  Df Deviance   AIC
## - previous        1    19118 19180
## - housing         1    19119 19181
## - education       7    19132 19182
## <none>                 19118 19182
## - loan            1    19120 19182
## - job            11    19161 19203
## - default         2    19145 19205
## - pdays           1    19146 19208
## - poutcome        2    19151 19211
## - cons.conf.idx   1    19253 19315
## - contact         1    19362 19424
## - cons.price.idx  1    19642 19704
## - emp.var.rate    1    20622 20684
## 
## Step:  AIC=19180.23
## y ~ job + education + default + housing + loan + contact + pdays + 
##     poutcome + emp.var.rate + cons.price.idx + cons.conf.idx
## 
##                  Df Deviance   AIC
## - housing         1    19120 19180
## - education       7    19132 19180
## <none>                 19118 19180
## - loan            1    19121 19181
## - job            11    19162 19202
## - default         2    19146 19204
## - pdays           1    19147 19207
## - poutcome        2    19218 19276
## - cons.conf.idx   1    19253 19313
## - contact         1    19363 19423
## - cons.price.idx  1    19667 19727
## - emp.var.rate    1    20653 20713
## 
## Step:  AIC=19179.66
## y ~ job + education + default + loan + contact + pdays + poutcome + 
##     emp.var.rate + cons.price.idx + cons.conf.idx
## 
##                  Df Deviance   AIC
## - loan            2    19123 19179
## - education       7    19133 19179
## <none>                 19120 19180
## - job            11    19163 19201
## - default         2    19147 19203
## - pdays           1    19149 19207
## - poutcome        2    19219 19275
## - cons.conf.idx   1    19256 19314
## - contact         1    19363 19421
## - cons.price.idx  1    19669 19727
## - emp.var.rate    1    20654 20712
## 
## Step:  AIC=19178.48
## y ~ job + education + default + contact + pdays + poutcome + 
##     emp.var.rate + cons.price.idx + cons.conf.idx
## 
##                  Df Deviance   AIC
## - education       7    19136 19178
## <none>                 19123 19179
## - job            11    19166 19200
## - default         2    19150 19202
## - pdays           1    19151 19205
## - poutcome        2    19222 19274
## - cons.conf.idx   1    19259 19313
## - contact         1    19366 19420
## - cons.price.idx  1    19672 19726
## - emp.var.rate    1    20658 20712
## 
## Step:  AIC=19178.22
## y ~ job + default + contact + pdays + poutcome + emp.var.rate + 
##     cons.price.idx + cons.conf.idx
## 
##                  Df Deviance   AIC
## <none>                 19136 19178
## - default         2    19164 19202
## - pdays           1    19165 19205
## - job            11    19191 19211
## - poutcome        2    19237 19275
## - cons.conf.idx   1    19280 19320
## - contact         1    19385 19425
## - cons.price.idx  1    19693 19733
## - emp.var.rate    1    20681 20721
AIC(lr4)
## [1] 19178.22
summary(lr4)
## 
## Call:
## glm(formula = y ~ job + default + contact + pdays + poutcome + 
##     emp.var.rate + cons.price.idx + cons.conf.idx, family = "binomial", 
##     data = bank_marketing_train)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -1.9100  -0.4162  -0.3238  -0.2797   2.9583  
## 
## Coefficients:
##                       Estimate Std. Error z value Pr(>|z|)    
## (Intercept)         -1.110e+02  4.650e+00 -23.863  < 2e-16 ***
## jobblue-collar      -2.618e-01  6.097e-02  -4.295 1.75e-05 ***
## jobentrepreneur     -9.485e-02  1.138e-01  -0.834 0.404516    
## jobhousemaid        -1.419e-01  1.321e-01  -1.074 0.282787    
## jobmanagement       -4.861e-02  8.023e-02  -0.606 0.544562    
## jobretired           2.660e-01  8.171e-02   3.255 0.001133 ** 
## jobself-employed    -1.380e-01  1.136e-01  -1.214 0.224663    
## jobservices         -2.120e-01  7.743e-02  -2.738 0.006180 ** 
## jobstudent           2.540e-01  9.971e-02   2.547 0.010855 *  
## jobtechnician       -2.225e-02  6.004e-02  -0.371 0.710965    
## jobunemployed       -9.283e-02  1.206e-01  -0.769 0.441599    
## jobunknown          -2.458e-01  2.320e-01  -1.060 0.289202    
## defaultunknown      -3.172e-01  6.211e-02  -5.106 3.28e-07 ***
## defaultyes          -7.640e+00  8.448e+01  -0.090 0.927943    
## contacttelephone    -8.798e-01  5.733e-02 -15.347  < 2e-16 ***
## pdays               -1.109e-03  2.059e-04  -5.386 7.22e-08 ***
## poutcomenonexistent  5.607e-01  6.150e-02   9.116  < 2e-16 ***
## poutcomesuccess      7.352e-01  2.071e-01   3.551 0.000384 ***
## emp.var.rate        -7.352e-01  1.897e-02 -38.753  < 2e-16 ***
## cons.price.idx       1.190e+00  4.988e-02  23.869  < 2e-16 ***
## cons.conf.idx        4.441e-02  3.720e-03  11.940  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 23735  on 33743  degrees of freedom
## Residual deviance: 19136  on 33723  degrees of freedom
## AIC: 19178
## 
## Number of Fisher Scoring iterations: 9

考察

ここで、ageなどの説明変数の重要性が減ってしまうのは、 emp.var.rateなどの説明変数の影響が大きいためと思われる ペルソナを定義するのに使用した説明変数と、それ以外で重要な説明変数を用いて モデリングをおこなう方針とする (emp.var.rate, cons.price.idx, cons.conf.idx を追加する)

続きはPytnで行う

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.